1
0
mirror of https://github.com/e107inc/e107.git synced 2025-10-12 21:45:11 +02:00
Files
php-e107/tests/_support/Helper/Base.php
Nick Liu b5b59392eb Started a basic interface to manipulate files in acceptance tests
- MOD: Renamed lib/deployers/cpanel_deployer.php to
       lib/deployers/cPanelDeployer.php
- MOD: Moved responsibility of reconfiguring Codeception modules to the
       deployers.
- NEW: Abstract class Deployer to standardize the interface to Deployers
- NEW: Acceptance tests now support unlinkE107ConfigFromTestEnvironment
- MOD: Removed null checks for the Deployer in the Base Module
- MOD: Improved public method naming in the Base Module
- MOD: DeployerFactory always returns a Deployer implementation now.
- MOD: InstallCest always clears out the e107_config.php file before
       each test.
2018-08-14 16:03:30 -05:00

61 lines
1.3 KiB
PHP

<?php
namespace Helper;
// here you can define custom actions
// all public methods declared in helper class will be available in $I
abstract class Base extends \Codeception\Module
{
protected $deployer;
protected $deployer_components = ['db', 'fs'];
protected $db;
public function getDbModule()
{
return $this->db ?: $this->db = $this->getModule('\Helper\DelayedDb');
}
public function getBrowserModule()
{
return $this->getModule('PhpBrowser');
}
public function _beforeSuite($settings = array())
{
$this->deployer = $this->getModule('\Helper\DeployerFactory')->create();
$this->deployer->setComponents($this->deployer_components);
$this->deployer->start();
$this->_callbackDeployerStarted();
foreach ($this->getModules() as $module)
{
if (get_class($module) !== get_class($this))
$module->_beforeSuite();
}
}
public function _afterSuite()
{
$this->deployer->stop();
}
protected function _callbackDeployerStarted()
{
foreach ($this->deployer_components as $component)
{
$method = "reconfigure_${component}";
if (method_exists($this->deployer, $method))
{
$this->deployer->$method($this);
}
}
}
public function _before(\Codeception\TestCase $test = null)
{
$this->_callbackDeployerStarted();
}
}