1
0
Fork 0
mirror of https://github.com/Oreolek/ifhub.club.git synced 2024-05-31 07:08:13 +03:00

Merge pull request #9 from Golfer/master

restored BaseFeatureContext
This commit is contained in:
Stepan Tanasiychuk 2012-10-31 03:23:02 -07:00
commit a8186d01fd
3 changed files with 73 additions and 60 deletions

2
.gitignore vendored
View file

@ -5,3 +5,5 @@
/tmp/
/config/config.local.php
/config/config.test.php
.gitmodules
plugins

View 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);
}
}

View file

@ -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);
}
}