2020-05-27 18:46:16 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
class HealthTest extends \CodeIgniter\Test\CIUnitTestCase
|
|
|
|
{
|
2020-08-04 11:25:22 +00:00
|
|
|
public function setUp(): void
|
|
|
|
{
|
|
|
|
parent::setUp();
|
|
|
|
}
|
2020-05-27 18:46:16 +02:00
|
|
|
|
2020-08-04 11:25:22 +00:00
|
|
|
public function testIsDefinedAppPath()
|
|
|
|
{
|
|
|
|
$test = defined('APPPATH');
|
2020-05-27 18:46:16 +02:00
|
|
|
|
2020-08-04 11:25:22 +00:00
|
|
|
$this->assertTrue($test);
|
|
|
|
}
|
2020-05-27 18:46:16 +02:00
|
|
|
|
2020-08-04 11:25:22 +00:00
|
|
|
public function testBaseUrlHasBeenSet()
|
|
|
|
{
|
|
|
|
$env = $config = false;
|
2020-05-27 18:46:16 +02:00
|
|
|
|
2020-08-04 11:25:22 +00:00
|
|
|
// First check in .env
|
|
|
|
if (is_file(HOMEPATH . '.env')) {
|
|
|
|
$env = (bool) preg_grep(
|
|
|
|
"/^app\.baseURL = './",
|
|
|
|
file(HOMEPATH . '.env')
|
|
|
|
);
|
|
|
|
}
|
2020-05-27 18:46:16 +02:00
|
|
|
|
2020-08-04 11:25:22 +00:00
|
|
|
// Then check the actual config file
|
|
|
|
$reader = new \Tests\Support\Libraries\ConfigReader();
|
|
|
|
$config = !empty($reader->baseUrl);
|
2020-05-27 18:46:16 +02:00
|
|
|
|
2020-08-04 11:25:22 +00:00
|
|
|
$this->assertTrue($env || $config);
|
|
|
|
}
|
2020-05-27 18:46:16 +02:00
|
|
|
}
|