mirror of
https://github.com/e107inc/e107.git
synced 2025-08-03 13:17:24 +02:00
Disabled VCS modification. Added fixed hash folder name and cleanup before/after tests.
This commit is contained in:
@@ -34,5 +34,6 @@ $HELP_DIRECTORY = 'e107_docs/help/';
|
|||||||
$MEDIA_DIRECTORY = 'e107_media/';
|
$MEDIA_DIRECTORY = 'e107_media/';
|
||||||
$SYSTEM_DIRECTORY = 'e107_system/';
|
$SYSTEM_DIRECTORY = 'e107_system/';
|
||||||
|
|
||||||
|
$E107_CONFIG = array('site_path' => '000000test');
|
||||||
|
|
||||||
define('e_MOD_REWRITE',true);
|
define('e_MOD_REWRITE',true);
|
||||||
|
@@ -9,16 +9,67 @@ abstract class E107Base extends Base
|
|||||||
const TEST_IN_PROGRESS = 'TEST-IN-PROGRESS';
|
const TEST_IN_PROGRESS = 'TEST-IN-PROGRESS';
|
||||||
const TEST_IN_PROGRESS_FILE = APP_PATH."/".self::TEST_IN_PROGRESS;
|
const TEST_IN_PROGRESS_FILE = APP_PATH."/".self::TEST_IN_PROGRESS;
|
||||||
const APP_PATH_E107_CONFIG = APP_PATH."/e107_config.php";
|
const APP_PATH_E107_CONFIG = APP_PATH."/e107_config.php";
|
||||||
|
const TEST_HASH = '000000test'; // see e107_config.php
|
||||||
public $e107_mySQLprefix = 'e107_';
|
public $e107_mySQLprefix = 'e107_';
|
||||||
|
|
||||||
public function _beforeSuite($settings = array())
|
public function _beforeSuite($settings = array())
|
||||||
{
|
{
|
||||||
$this->backupLocalE107Config();
|
$this->backupLocalE107Config();
|
||||||
$this->setVcsInProgress();
|
$this->deleteHashDirs();
|
||||||
|
// $this->setVcsInProgress();
|
||||||
parent::_beforeSuite($settings);
|
parent::_beforeSuite($settings);
|
||||||
$this->writeLocalE107Config();
|
$this->writeLocalE107Config();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected function deleteHashDirs()
|
||||||
|
{
|
||||||
|
$system = APP_PATH."/e107_system/".self::TEST_HASH;
|
||||||
|
$this->deleteDir($system);
|
||||||
|
|
||||||
|
$media = APP_PATH."/e107_media/".self::TEST_HASH;
|
||||||
|
$this->deleteDir($media);
|
||||||
|
|
||||||
|
if(is_dir($system))
|
||||||
|
{
|
||||||
|
echo "Couldn't delete ".$system;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private function deleteDir($dirPath)
|
||||||
|
{
|
||||||
|
|
||||||
|
if(!is_dir($dirPath))
|
||||||
|
{
|
||||||
|
// echo ($dirPath . "must be a directory");
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(substr($dirPath, strlen($dirPath) - 1, 1) != '/')
|
||||||
|
{
|
||||||
|
$dirPath .= '/';
|
||||||
|
}
|
||||||
|
|
||||||
|
$files = glob($dirPath . '*', GLOB_MARK);
|
||||||
|
|
||||||
|
foreach($files as $file)
|
||||||
|
{
|
||||||
|
if(is_dir($file))
|
||||||
|
{
|
||||||
|
$this->deleteDir($file);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
unlink($file);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(is_dir($dirPath))
|
||||||
|
{
|
||||||
|
rmdir($dirPath);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
protected function backupLocalE107Config()
|
protected function backupLocalE107Config()
|
||||||
{
|
{
|
||||||
if(file_exists(self::APP_PATH_E107_CONFIG))
|
if(file_exists(self::APP_PATH_E107_CONFIG))
|
||||||
@@ -140,8 +191,9 @@ abstract class E107Base extends Base
|
|||||||
{
|
{
|
||||||
parent::_afterSuite();
|
parent::_afterSuite();
|
||||||
$this->revokeLocalE107Config();
|
$this->revokeLocalE107Config();
|
||||||
$this->unsetVcsInProgress();
|
// $this->unsetVcsInProgress();
|
||||||
$this->restoreLocalE107Config();
|
$this->restoreLocalE107Config();
|
||||||
|
$this->deleteHashDirs();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function revokeLocalE107Config()
|
protected function revokeLocalE107Config()
|
||||||
|
@@ -12,18 +12,44 @@
|
|||||||
class e107Test extends \Codeception\Test\Unit
|
class e107Test extends \Codeception\Test\Unit
|
||||||
{
|
{
|
||||||
|
|
||||||
/* public function testGetInstance()
|
/** @var e107 */
|
||||||
|
private $e107;
|
||||||
|
|
||||||
|
protected function _before()
|
||||||
{
|
{
|
||||||
$res = null;
|
try
|
||||||
$this->assertTrue($res);
|
{
|
||||||
|
$this->e107 = e107::getInstance();
|
||||||
|
}
|
||||||
|
catch (Exception $e)
|
||||||
|
{
|
||||||
|
$this->fail("Couldn't load e107 object");
|
||||||
|
}
|
||||||
|
|
||||||
|
// var_dump($this->e107);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testGetInstance()
|
||||||
|
{
|
||||||
|
// $this->e107->getInstance();
|
||||||
|
//$res = $this->e107::getInstance();
|
||||||
|
// $this->assertTrue($res);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testInitCore()
|
public function testInitCore()
|
||||||
{
|
{
|
||||||
$res = null;
|
//$res = null;
|
||||||
$this->assertTrue($res);
|
require(APP_PATH.'e107_config.php'); // contains $E107_CONFIG = array('site_path' => '000000test');
|
||||||
|
|
||||||
|
$e107_paths = compact('ADMIN_DIRECTORY', 'FILES_DIRECTORY', 'IMAGES_DIRECTORY', 'THEMES_DIRECTORY', 'PLUGINS_DIRECTORY', 'HANDLERS_DIRECTORY', 'LANGUAGES_DIRECTORY', 'HELP_DIRECTORY', 'DOWNLOADS_DIRECTORY','UPLOADS_DIRECTORY','SYSTEM_DIRECTORY', 'MEDIA_DIRECTORY','CACHE_DIRECTORY','LOGS_DIRECTORY', 'CORE_DIRECTORY', 'WEB_DIRECTORY');
|
||||||
|
$sql_info = compact('mySQLserver', 'mySQLuser', 'mySQLpassword', 'mySQLdefaultdb', 'mySQLprefix', 'mySQLport');
|
||||||
|
$res = $this->e107->initCore($e107_paths, e_ROOT, $sql_info, varset($E107_CONFIG, array()));
|
||||||
|
|
||||||
|
$this->assertEquals('000000test', $res->site_path);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
public function testInitInstall()
|
public function testInitInstall()
|
||||||
{
|
{
|
||||||
$res = null;
|
$res = null;
|
||||||
|
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user