mirror of
https://github.com/e107inc/e107.git
synced 2025-08-06 14:46:56 +02:00
Quick tests for e_MEDIA_BASE and e_SYSTEM_BASE added. Disabled creation of e107_config.php (will halt installation test if found)
This commit is contained in:
@@ -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);
|
||||
?>
|
||||
|
||||
|
@@ -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);
|
||||
}
|
||||
|
||||
|
@@ -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);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user