mirror of
https://github.com/e107inc/e107.git
synced 2025-08-05 14:17:49 +02:00
Merge branch 'master' of https://github.com/e107inc/e107-test
This commit is contained in:
@@ -19,12 +19,6 @@ extensions:
|
|||||||
- Codeception\Extension\RunFailed
|
- Codeception\Extension\RunFailed
|
||||||
modules:
|
modules:
|
||||||
enabled:
|
enabled:
|
||||||
- \Helper\DelayedDb:
|
|
||||||
dsn: 'mysql:host=%manual.db.host%;port=%manual.db.port%;dbname=%manual.db.dbname%'
|
|
||||||
user: '%manual.db.user%'
|
|
||||||
password: '%manual.db.password%'
|
|
||||||
populate: true
|
|
||||||
dump: 'tests/_data/e107_v2.1.8.sample.sql'
|
|
||||||
- \Helper\DeployerFactory:
|
- \Helper\DeployerFactory:
|
||||||
secrets:
|
secrets:
|
||||||
cpanel:
|
cpanel:
|
||||||
@@ -32,3 +26,9 @@ modules:
|
|||||||
hostname: '%cpanel.hostname%'
|
hostname: '%cpanel.hostname%'
|
||||||
username: '%cpanel.username%'
|
username: '%cpanel.username%'
|
||||||
password: '%cpanel.password%'
|
password: '%cpanel.password%'
|
||||||
|
- \Helper\DelayedDb:
|
||||||
|
dsn: 'mysql:host=%manual.db.host%;port=%manual.db.port%;dbname=%manual.db.dbname%'
|
||||||
|
user: '%manual.db.user%'
|
||||||
|
password: '%manual.db.password%'
|
||||||
|
populate: true
|
||||||
|
dump: 'tests/_data/e107_v2.1.8.sample.sql'
|
||||||
|
@@ -6,8 +6,15 @@ namespace Helper;
|
|||||||
|
|
||||||
abstract class Base extends \Codeception\Module
|
abstract class Base extends \Codeception\Module
|
||||||
{
|
{
|
||||||
protected $deployer;
|
protected $deployer;
|
||||||
protected $deployer_components = ['db', 'fs'];
|
protected $deployer_components = ['db', 'fs'];
|
||||||
|
|
||||||
|
protected $db;
|
||||||
|
|
||||||
|
public function getHelperDb()
|
||||||
|
{
|
||||||
|
return $this->db ?: $this->db = $this->getModule('\Helper\DelayedDb');
|
||||||
|
}
|
||||||
|
|
||||||
public function _beforeSuite($settings = array())
|
public function _beforeSuite($settings = array())
|
||||||
{
|
{
|
||||||
@@ -24,37 +31,37 @@ abstract class Base extends \Codeception\Module
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function _afterSuite()
|
public function _afterSuite()
|
||||||
{
|
{
|
||||||
if (is_object($this->deployer))
|
if (is_object($this->deployer))
|
||||||
$this->deployer->stop();
|
$this->deployer->stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function _callbackDeployerStarted()
|
protected function _callbackDeployerStarted()
|
||||||
{
|
{
|
||||||
foreach ($this->deployer_components as $component)
|
foreach ($this->deployer_components as $component)
|
||||||
{
|
{
|
||||||
$method = "_reconfigure_${component}";
|
$method = "_reconfigure_${component}";
|
||||||
$this->$method();
|
$this->$method();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function _reconfigure_fs()
|
protected function _reconfigure_fs()
|
||||||
{
|
{
|
||||||
$url = $this->deployer->getUrl();
|
$url = $this->deployer->getUrl();
|
||||||
$browser = $this->getModule('PhpBrowser');
|
$browser = $this->getModule('PhpBrowser');
|
||||||
$browser->_reconfigure(array('url' => $url));
|
$browser->_reconfigure(array('url' => $url));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function _reconfigure_db()
|
protected function _reconfigure_db()
|
||||||
{
|
{
|
||||||
$db = $this->getModule('\Helper\DelayedDb');
|
$db = $this->getHelperDb();
|
||||||
$Db_config = $db->getConfig();
|
$Db_config = $db->_getConfig();
|
||||||
$Db_config['dsn'] = $this->deployer->getDsn();
|
$Db_config['dsn'] = $this->deployer->getDsn();
|
||||||
$Db_config['user'] = $this->deployer->getDbUsername();
|
$Db_config['user'] = $this->deployer->getDbUsername();
|
||||||
$Db_config['password'] = $this->deployer->getDbPassword();
|
$Db_config['password'] = $this->deployer->getDbPassword();
|
||||||
$db->_reconfigure($Db_config);
|
$db->_reconfigure($Db_config);
|
||||||
// Next line is used to make connection available to any code after this point
|
// Next line is used to make connection available to any code after this point
|
||||||
//$this->getModule('\Helper\DelayedDb')->_delayedInitialize();
|
//$this->getModule('\Helper\DelayedDb')->_delayedInitialize();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -18,41 +18,36 @@ class DelayedDb extends \Codeception\Module\Db
|
|||||||
return parent::_initialize();
|
return parent::_initialize();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getConfig()
|
public function _getDbHostname()
|
||||||
{
|
|
||||||
return $this->config;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getDbHostname()
|
|
||||||
{
|
{
|
||||||
$matches = [];
|
$matches = [];
|
||||||
$matched = preg_match('~host=([^;]+)~s', $this->config['dsn'], $matches);
|
$matched = preg_match('~host=([^;]+)~s', $this->config['dsn'], $matches);
|
||||||
if (!$matched)
|
if (!$matched)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $matches[1];
|
return $matches[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getDbName()
|
public function _getDbName()
|
||||||
{
|
{
|
||||||
$matches = [];
|
$matches = [];
|
||||||
$matched = preg_match('~dbname=([^;]+)~s', $this->config['dsn'], $matches);
|
$matched = preg_match('~dbname=([^;]+)~s', $this->config['dsn'], $matches);
|
||||||
if (!$matched)
|
if (!$matched)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $matches[1];
|
return $matches[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getDbUsername()
|
public function _getDbUsername()
|
||||||
{
|
{
|
||||||
return $this->config['user'];
|
return $this->config['user'];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getDbPassword()
|
public function _getDbPassword()
|
||||||
{
|
{
|
||||||
return $this->config['password'];
|
return $this->config['password'];
|
||||||
}
|
}
|
||||||
|
@@ -31,10 +31,10 @@ abstract class E107Base extends Base
|
|||||||
$db = $this->getModule('\Helper\DelayedDb');
|
$db = $this->getModule('\Helper\DelayedDb');
|
||||||
|
|
||||||
$e107_config = [];
|
$e107_config = [];
|
||||||
$e107_config['mySQLserver'] = $db->getDbHostname();
|
$e107_config['mySQLserver'] = $db->_getDbHostname();
|
||||||
$e107_config['mySQLuser'] = $db->getDbUsername();
|
$e107_config['mySQLuser'] = $db->_getDbUsername();
|
||||||
$e107_config['mySQLpassword'] = $db->getDbPassword();
|
$e107_config['mySQLpassword'] = $db->_getDbPassword();
|
||||||
$e107_config['mySQLdefaultdb'] = $db->getDbName();
|
$e107_config['mySQLdefaultdb'] = $db->_getDbName();
|
||||||
$e107_config['mySQLprefix'] = $this->e107_mySQLprefix;
|
$e107_config['mySQLprefix'] = $this->e107_mySQLprefix;
|
||||||
|
|
||||||
$e107_config_contents = $twig->render('e107_config.php', $e107_config);
|
$e107_config_contents = $twig->render('e107_config.php', $e107_config);
|
||||||
|
@@ -3,43 +3,42 @@
|
|||||||
|
|
||||||
class InstallCest
|
class InstallCest
|
||||||
{
|
{
|
||||||
public function _before(AcceptanceTester $I)
|
public function _before(AcceptanceTester $I)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
public function _after(AcceptanceTester $I)
|
public function _after(AcceptanceTester $I)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
// tests
|
// tests
|
||||||
public function installWelcomePageContainsExpectedContent(AcceptanceTester $I)
|
public function installWelcomePageContainsExpectedContent(AcceptanceTester $I)
|
||||||
{
|
{
|
||||||
|
$I->amOnPage('/install.php');
|
||||||
|
|
||||||
$I->amOnPage('/install.php');
|
|
||||||
$I->see("e107 Installation :: Step 1");
|
$I->see("e107 Installation :: Step 1");
|
||||||
$I->see("Language Selection");
|
$I->see("Language Selection");
|
||||||
}
|
}
|
||||||
|
|
||||||
public function installStep1ToStep2(AcceptanceTester $I)
|
public function installStep1ToStep2(AcceptanceTester $I)
|
||||||
{
|
{
|
||||||
$I->amOnPage('/install.php');
|
$I->amOnPage('/install.php');
|
||||||
$I->wantTo("Verify Proceed to Step 2 of the Installation");
|
$I->wantTo("Verify Proceed to Step 2 of the Installation");
|
||||||
$I->selectOption("language", 'English');
|
$I->selectOption("language", 'English');
|
||||||
$I->click('start');
|
$I->click('start');
|
||||||
$I->see("MySQL Server Details", 'h3');
|
$I->see("MySQL Server Details", 'h3');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function installStep2ToStep3(AcceptanceTester $I)
|
public function installStep2ToStep3(AcceptanceTester $I)
|
||||||
{
|
{
|
||||||
$I->amOnPage('/install.php');
|
$I->amOnPage('/install.php');
|
||||||
$I->wantTo("Verify Proceed to Step 3 of the Installation");
|
$I->wantTo("Verify Proceed to Step 3 of the Installation");
|
||||||
$this->installStep1ToStep2($I);
|
$db = $I->getHelperDb();
|
||||||
|
$this->installStep1ToStep2($I);
|
||||||
|
|
||||||
$I->fillField('server', $I->getDbHostname());
|
$I->fillField('server', $db->_getDbHostname());
|
||||||
$I->fillField('name', $I->getDbUsername());
|
$I->fillField('name', $db->_getDbUsername());
|
||||||
$I->fillField('password', $I->getDbPassword());
|
$I->fillField('password', $db->_getDbPassword());
|
||||||
$I->fillField('db', $I->getDbName());
|
$I->fillField('db', $db->_getDbName());
|
||||||
|
|
||||||
$I->uncheckOption('createdb');
|
$I->uncheckOption('createdb');
|
||||||
$I->click('submit');
|
$I->click('submit');
|
||||||
@@ -47,83 +46,83 @@ class InstallCest
|
|||||||
$I->see("MySQL Connection Verification", 'h3');
|
$I->see("MySQL Connection Verification", 'h3');
|
||||||
|
|
||||||
// ....
|
// ....
|
||||||
}
|
}
|
||||||
|
|
||||||
public function installStep3ToStep4(AcceptanceTester $I)
|
public function installStep3ToStep4(AcceptanceTester $I)
|
||||||
{
|
{
|
||||||
|
|
||||||
$I->amOnPage('/install.php');
|
$I->amOnPage('/install.php');
|
||||||
$I->wantTo("Verify Proceed to Step 4 of the Installation");
|
$I->wantTo("Verify Proceed to Step 4 of the Installation");
|
||||||
|
|
||||||
$this->installStep2ToStep3($I);
|
$this->installStep2ToStep3($I);
|
||||||
|
|
||||||
// $I->see("Connection to the MySQL server established and verified");
|
// $I->see("Connection to the MySQL server established and verified");
|
||||||
$I->see("Found existing database");
|
$I->see("Found existing database");
|
||||||
|
|
||||||
$I->click('submit');
|
$I->click('submit');
|
||||||
|
|
||||||
$I->see("PHP and MySQL Versions Check / File Permissions Check");
|
$I->see("PHP and MySQL Versions Check / File Permissions Check");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function installStep4ToStep5(AcceptanceTester $I) // TODO Fails due to e107_config.php being present.
|
public function installStep4ToStep5(AcceptanceTester $I) // TODO Fails due to e107_config.php being present.
|
||||||
{
|
{
|
||||||
|
|
||||||
$I->amOnPage('/install.php');
|
$I->amOnPage('/install.php');
|
||||||
$I->wantTo("Verify Proceed to Step 5 of the Installation");
|
$I->wantTo("Verify Proceed to Step 5 of the Installation");
|
||||||
|
|
||||||
$this->installStep3ToStep4($I);
|
$this->installStep3ToStep4($I);
|
||||||
|
|
||||||
$I->canSee('You might have an existing installation'); //XXX Triggered if e107_config.php is not empty
|
$I->canSee('You might have an existing installation'); //XXX Triggered if e107_config.php is not empty
|
||||||
|
|
||||||
$I->click('continue_install');
|
$I->click('continue_install');
|
||||||
|
|
||||||
$I->see("Administration", 'h3');
|
$I->see("Administration", 'h3');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function installStep5ToStep6(AcceptanceTester $I)
|
public function installStep5ToStep6(AcceptanceTester $I)
|
||||||
{
|
{
|
||||||
|
|
||||||
$I->amOnPage('/install.php');
|
$I->amOnPage('/install.php');
|
||||||
$I->wantTo("Verify Proceed to Step 6 of the Installation");
|
$I->wantTo("Verify Proceed to Step 6 of the Installation");
|
||||||
$this->installStep4ToStep5($I);
|
$this->installStep4ToStep5($I);
|
||||||
|
|
||||||
$I->fillField('u_name', 'admin');
|
$I->fillField('u_name', 'admin');
|
||||||
$I->fillField('d_name', 'admin');
|
$I->fillField('d_name', 'admin');
|
||||||
$I->fillField('pass1', 'admin');
|
$I->fillField('pass1', 'admin');
|
||||||
$I->fillField('pass2', 'admin');
|
$I->fillField('pass2', 'admin');
|
||||||
$I->fillField('email', 'admin@admin.com');
|
$I->fillField('email', 'admin@admin.com');
|
||||||
|
|
||||||
$I->click('submit');
|
$I->click('submit');
|
||||||
|
|
||||||
$I->see("Website Preferences", 'h3');
|
$I->see("Website Preferences", 'h3');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function installStep6ToStep7(AcceptanceTester $I)
|
public function installStep6ToStep7(AcceptanceTester $I)
|
||||||
{
|
{
|
||||||
|
|
||||||
$I->amOnPage('/install.php');
|
$I->amOnPage('/install.php');
|
||||||
$I->wantTo("Verify Proceed to Step 7 of the Installation");
|
$I->wantTo("Verify Proceed to Step 7 of the Installation");
|
||||||
$this->installStep5ToStep6($I);
|
$this->installStep5ToStep6($I);
|
||||||
|
|
||||||
$I->fillField('sitename', 'Test Site');
|
$I->fillField('sitename', 'Test Site');
|
||||||
|
|
||||||
$I->click('submit');
|
$I->click('submit');
|
||||||
|
|
||||||
$I->see("Install Confirmation", 'h3');
|
$I->see("Install Confirmation", 'h3');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function installStep7ToStep8(AcceptanceTester $I)
|
public function installStep7ToStep8(AcceptanceTester $I)
|
||||||
{
|
{
|
||||||
|
|
||||||
$I->amOnPage('/install.php');
|
$I->amOnPage('/install.php');
|
||||||
$I->wantTo("Verify Proceed to Step 8 of the Installation");
|
$I->wantTo("Verify Proceed to Step 8 of the Installation");
|
||||||
$this->installStep6ToStep7($I);
|
$this->installStep6ToStep7($I);
|
||||||
|
|
||||||
$I->see("Install Confirmation", 'h3');
|
|
||||||
|
|
||||||
$I->click('submit');
|
|
||||||
|
|
||||||
$I->see("Install Confirmation", 'h3');
|
$I->see("Install Confirmation", 'h3');
|
||||||
}
|
|
||||||
|
$I->click('submit');
|
||||||
|
|
||||||
|
$I->see("Install Confirmation", 'h3');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user