Using new and more flexible 'testsession' module instead of dev/tests/setdb

This commit is contained in:
Ingo Schommer 2012-12-19 15:55:54 +01:00
parent f55029c4aa
commit 95b9408c86
2 changed files with 13 additions and 5 deletions

View File

@ -22,7 +22,8 @@
"behat/mink": "1.4@stable", "behat/mink": "1.4@stable",
"behat/mink-extension": "1.0@stable", "behat/mink-extension": "1.0@stable",
"behat/mink-selenium2-driver": "*", "behat/mink-selenium2-driver": "*",
"behat/mink-goutte-driver": "*" "behat/mink-goutte-driver": "*",
"silverstripe/testsession": "*"
}, },
"autoload": { "autoload": {

View File

@ -151,12 +151,19 @@ class SilverStripeContext extends MinkContext implements SilverStripeAwareContex
public function before(ScenarioEvent $event) public function before(ScenarioEvent $event)
{ {
if (!isset($this->databaseName)) { if (!isset($this->databaseName)) {
throw new \LogicException('Context\'s $databaseName has to be set when implementing SilverStripeAwareContextInterface.'); throw new \LogicException(
'Context\'s $databaseName has to be set when implementing '
. 'SilverStripeAwareContextInterface.'
);
} }
$setdbUrl = $this->joinUrlParts($this->getBaseUrl(), '/dev/tests/setdb'); $url = $this->joinUrlParts($this->getBaseUrl(), '/dev/testsession/start');
$setdbUrl = sprintf('%s?database=%s', $setdbUrl, $this->databaseName); $params = array(
$this->getSession()->visit($setdbUrl); 'database' => $this->databaseName,
);
$url .= '?' . http_build_query($params);
$this->getSession()->visit($url);
} }
/** /**