mirror of
https://github.com/silverstripe/silverstripe-behat-extension
synced 2024-10-22 17:05:32 +02:00
Using new and more flexible 'testsession' module instead of dev/tests/setdb
This commit is contained in:
parent
f55029c4aa
commit
95b9408c86
@ -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": {
|
||||||
|
@ -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);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user