mirror of
https://code.castopod.org/adaures/castopod.git
synced 2024-09-10 20:43:22 +02:00
- update CI4 to v4.1.9's stable production package - update php and js dependencies to latest
53 lines
1.5 KiB
PHP
53 lines
1.5 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
use CodeIgniter\Test\CIUnitTestCase;
|
|
use Config\App;
|
|
use Config\Services;
|
|
use Tests\Support\Libraries\ConfigReader;
|
|
|
|
/**
|
|
* @internal
|
|
*/
|
|
final class HealthTest extends CIUnitTestCase
|
|
{
|
|
public function testIsDefinedAppPath(): void
|
|
{
|
|
$this->assertTrue(defined('APPPATH'));
|
|
}
|
|
|
|
public function testBaseUrlHasBeenSet(): void
|
|
{
|
|
$validation = Services::validation();
|
|
|
|
$env = false;
|
|
|
|
// Check the baseURL in .env
|
|
if (is_file(HOMEPATH . '.env')) {
|
|
$env = preg_grep('~^app\.baseURL = .~', file(HOMEPATH . '.env')) !== false;
|
|
}
|
|
|
|
if ($env) {
|
|
// BaseURL in .env is a valid URL?
|
|
// phpunit.xml.dist sets app.baseURL in $_SERVER
|
|
// So if you set app.baseURL in .env, it takes precedence
|
|
$config = new App();
|
|
$this->assertTrue(
|
|
$validation->check($config->baseURL, 'valid_url_strict'),
|
|
'baseURL "' . $config->baseURL . '" in .env is not valid URL'
|
|
);
|
|
}
|
|
|
|
// Get the baseURL in app/Config/App.php
|
|
// You can't use Config\App, because phpunit.xml.dist sets app.baseURL
|
|
$reader = new ConfigReader();
|
|
|
|
// BaseURL in app/Config/App.php is a valid URL?
|
|
$this->assertTrue(
|
|
$validation->check($reader->baseURL, 'valid_url_strict'),
|
|
'baseURL "' . $reader->baseURL . '" in app/Config/App.php is not valid URL'
|
|
);
|
|
}
|
|
}
|