diff --git a/tests/_data/e107_config.php.sample b/tests/_data/e107_config.php.sample index 5a4a4eeb0..96edfcaa4 100644 --- a/tests/_data/e107_config.php.sample +++ b/tests/_data/e107_config.php.sample @@ -31,7 +31,9 @@ $PLUGINS_DIRECTORY = 'e107_plugins/'; $HANDLERS_DIRECTORY = 'e107_handlers/'; $LANGUAGES_DIRECTORY = 'e107_languages/'; $HELP_DIRECTORY = 'e107_docs/help/'; -$DOWNLOADS_DIRECTORY = 'e107_files/downloads/'; +$MEDIA_DIRECTORY = 'e107_media/'; +$SYSTEM_DIRECTORY = 'e107_system/'; + define('e_MOD_REWRITE',true); -?> + diff --git a/tests/_support/Helper/E107Base.php b/tests/_support/Helper/E107Base.php index 4e62c3dd6..ae6b62348 100644 --- a/tests/_support/Helper/E107Base.php +++ b/tests/_support/Helper/E107Base.php @@ -12,16 +12,16 @@ abstract class E107Base extends Base public function _beforeSuite($settings = array()) { parent::_beforeSuite($settings); - $this->writeLocalE107Config(); + //$this->writeLocalE107Config(); // created during installation test. } public function _afterSuite() { parent::_afterSuite(); - $this->revokeLocalE107Config(); + //$this->revokeLocalE107Config(); // temporarily disabled. } - protected function writeLocalE107Config() + protected function writeLocalE107Config() // TODO create config.yml option to disable adding/removing e107_config.php { $twig_loader = new \Twig_Loader_Array([ 'e107_config.php' => file_get_contents(codecept_data_dir()."/e107_config.php.sample") @@ -38,6 +38,12 @@ abstract class E107Base extends Base $e107_config['mySQLprefix'] = $this->e107_mySQLprefix; $e107_config_contents = $twig->render('e107_config.php', $e107_config); + + if(file_exists(self::APP_PATH_E107_CONFIG)) // precaution. + { + rename(self::APP_PATH_E107_CONFIG, str_replace(".php", "_".time().".php", self::APP_PATH_E107_CONFIG)); + } + file_put_contents(self::APP_PATH_E107_CONFIG, $e107_config_contents); } diff --git a/tests/unit/ConstantsTest.php b/tests/unit/ConstantsTest.php index 2e5d92831..82f682685 100644 --- a/tests/unit/ConstantsTest.php +++ b/tests/unit/ConstantsTest.php @@ -8,14 +8,53 @@ * */ - use PHPUnit\Framework\TestCase; - class e107ConstantsTest extends TestCase + class e107ConstantsTest extends \Codeception\Test\Unit { - public function teste_BASE() + public function testVerifyE_BASE() { - // todo + $res = defined('e_BASE'); $this->assertTrue($res); } + + public function testVerifyE_SYSTEM_BASE() + { + $res = true; + + if(!defined('e_SYSTEM')) + { + $res = false; + } + elseif(!defined('e_SYSTEM_BASE')) + { + $res = false; + } + elseif(e_SYSTEM_BASE === e_SYSTEM) + { + $res = false; + } + + $this->assertTrue($res); + } + + public function testVerifyE_MEDIA_BASE() + { + $res = true; + + if(!defined('e_MEDIA')) + { + $res = false; + } + elseif(!defined('e_MEDIA_BASE')) + { + $res = false; + } + elseif(e_MEDIA_BASE === e_MEDIA) + { + $res = false; + } + + $this->assertTrue($res); + } }