moved default session configuration and active sessions teardown into initializer

This commit is contained in:
everzet
2012-05-11 10:10:51 +02:00
parent 74bcde4820
commit 65747ef131
4 changed files with 73 additions and 54 deletions

View File

@@ -23,31 +23,6 @@ use Behat\Behat\Context\TranslatedContextInterface,
*/
class MinkContext extends RawMinkContext implements TranslatedContextInterface
{
/**
* @BeforeScenario
*/
public function prepareMinkSessions($event)
{
$scenario = $event instanceof ScenarioEvent ? $event->getScenario() : $event->getOutline();
$session = $this->getMinkParameter('default_session');
foreach ($scenario->getTags() as $tag) {
if ('javascript' === $tag) {
$session = $this->getMinkParameter('javascript_session');
} elseif (preg_match('/^mink\:(.+)/', $tag, $matches)) {
$session = $matches[1];
}
}
if ($scenario->hasTag('insulated')) {
$this->getMink()->stopSessions();
} else {
$this->getMink()->resetSessions();
}
$this->getMink()->setDefaultSessionName($session);
}
/**
* Opens specified page.
*