mirror of
https://github.com/Oreolek/ifhub.club.git
synced 2024-05-31 07:08:13 +03:00
commit
a8186d01fd
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -5,3 +5,5 @@
|
|||
/tmp/
|
||||
/config/config.local.php
|
||||
/config/config.test.php
|
||||
.gitmodules
|
||||
plugins
|
||||
|
|
69
tests/behat/features/bootstrap/BaseFeatureContext.php
Normal file
69
tests/behat/features/bootstrap/BaseFeatureContext.php
Normal file
|
@ -0,0 +1,69 @@
|
|||
<?php
|
||||
|
||||
use Behat\Behat\Context\ClosuredContextInterface,
|
||||
Behat\Behat\Context\TranslatedContextInterface,
|
||||
Behat\Behat\Context\BehatContext,
|
||||
Behat\MinkExtension\Context\MinkContext,
|
||||
Behat\Behat\Exception\PendingException;
|
||||
use Behat\Gherkin\Node\PyStringNode,
|
||||
Behat\Gherkin\Node\TableNode;
|
||||
|
||||
$sDirRoot = dirname(realpath((dirname(__FILE__)) . "/../../../"));
|
||||
set_include_path(get_include_path().PATH_SEPARATOR.$sDirRoot);
|
||||
|
||||
require_once("tests/LoadFixtures.php");
|
||||
|
||||
/**
|
||||
* LiveStreet custom feature context
|
||||
*/
|
||||
class FeatureContext extends MinkContext
|
||||
{
|
||||
|
||||
protected static $fixturesLoader = null;
|
||||
|
||||
/**
|
||||
* Get fixtures loader
|
||||
* @return LoadFixtures
|
||||
*/
|
||||
protected static function getFixturesLoader()
|
||||
{
|
||||
if (is_null(self::$fixturesLoader)) {
|
||||
self::$fixturesLoader = new LoadFixtures();
|
||||
}
|
||||
|
||||
return self::$fixturesLoader;
|
||||
}
|
||||
|
||||
/**
|
||||
* Purge DB and load fixtures before running each test
|
||||
*
|
||||
* @BeforeScenario
|
||||
*/
|
||||
public static function prepare($event){
|
||||
$fixturesLoader = self::getFixturesLoader();
|
||||
$fixturesLoader->purgeDB();
|
||||
$fixturesLoader->load();
|
||||
}
|
||||
|
||||
/**
|
||||
* Loading fixture for plugin
|
||||
*
|
||||
* @Given /^I load fixtures for plugin "([^"]*)"$/
|
||||
*/
|
||||
public function loadFixturesForPlugin($plugin)
|
||||
{
|
||||
$fixturesLoader = $this->getFixturesLoader();
|
||||
$fixturesLoader->loadPluginFixtures($plugin);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @Given /^I am activated plugin "([^"]*)"$/
|
||||
*/
|
||||
public function ActivatedPlugin($plugin)
|
||||
{
|
||||
$pluginActivation = new LoadFixtures();
|
||||
$pluginActivation->activationPlugin($plugin);
|
||||
}
|
||||
|
||||
}
|
|
@ -1,69 +1,11 @@
|
|||
<?php
|
||||
|
||||
use Behat\Behat\Context\ClosuredContextInterface,
|
||||
Behat\Behat\Context\TranslatedContextInterface,
|
||||
Behat\Behat\Context\BehatContext,
|
||||
Behat\MinkExtension\Context\MinkContext,
|
||||
Behat\Behat\Exception\PendingException;
|
||||
use Behat\Gherkin\Node\PyStringNode,
|
||||
Behat\Gherkin\Node\TableNode;
|
||||
|
||||
$sDirRoot = dirname(realpath((dirname(__FILE__)) . "/../../../"));
|
||||
set_include_path(get_include_path().PATH_SEPARATOR.$sDirRoot);
|
||||
|
||||
require_once("tests/LoadFixtures.php");
|
||||
require_once("BaseFeatureContext.php");
|
||||
|
||||
/**
|
||||
* LiveStreet custom feature context
|
||||
*/
|
||||
class FeatureContext extends MinkContext
|
||||
class BaseFeatureContext extends FeatureContext
|
||||
{
|
||||
|
||||
protected static $fixturesLoader = null;
|
||||
|
||||
/**
|
||||
* Get fixtures loader
|
||||
* @return LoadFixtures
|
||||
*/
|
||||
protected static function getFixturesLoader()
|
||||
{
|
||||
if (is_null(self::$fixturesLoader)) {
|
||||
self::$fixturesLoader = new LoadFixtures();
|
||||
}
|
||||
|
||||
return self::$fixturesLoader;
|
||||
}
|
||||
|
||||
/**
|
||||
* Purge DB and load fixtures before running each test
|
||||
*
|
||||
* @BeforeScenario
|
||||
*/
|
||||
public static function prepare($event){
|
||||
$fixturesLoader = self::getFixturesLoader();
|
||||
$fixturesLoader->purgeDB();
|
||||
$fixturesLoader->load();
|
||||
}
|
||||
|
||||
/**
|
||||
* Loading fixture for plugin
|
||||
*
|
||||
* @Given /^I load fixtures for plugin "([^"]*)"$/
|
||||
*/
|
||||
public function loadFixturesForPlugin($plugin)
|
||||
{
|
||||
$fixturesLoader = $this->getFixturesLoader();
|
||||
$fixturesLoader->loadPluginFixtures($plugin);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @Given /^I am activated plugin "([^"]*)"$/
|
||||
*/
|
||||
public function ActivatedPlugin($plugin)
|
||||
{
|
||||
$pluginActivation = new LoadFixtures();
|
||||
$pluginActivation->activationPlugin($plugin);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue