Env var support, documented xdebug usage

This commit is contained in:
Ingo Schommer 2013-12-18 14:57:37 +01:00
parent 58a9d59e7f
commit 22330d02cb
2 changed files with 29 additions and 3 deletions

View File

@ -338,6 +338,26 @@ where `10000` is the number of millisecods you wish the session to wait.
It is very useful when you want to look at the error or developer console
inside the browser or if you want to interact with the session page manually.
### Can I set breakpoints through XDebug?
If you have [XDebug](http://xdebug.org) set up, breakpoints are your friend.
The problem is that you can only connect the debugger to the PHP execution
in the CLI, or in the browser, not both at the same time.
First of all, ensure that `xdebug.remote_autostart` is set to `Off`,
otherwise you'll always have an active debugging session in CLI, never in the browser.
Then you can choose to enable XDebug for the current CLI run:
XDEBUG_CONFIG="idekey=macgdbp" vendor/bin/behat
Or you can use the `TESTSESSION_PARAMS` environment variable to pass additional
parameters to `dev/testsession/start`, and debug in the browser instead.
TESTSESSION_PARAMS="XDEBUG_SESSION_START=macgdbp" vendor/bin/behat @app
The `macgdbp` IDE key needs to match your `xdebug.idekey` php.ini setting.
### How do I use SauceLabs.com for remote Selenium2 testing?
Here's a sample profile for your `behat.yml`:

View File

@ -161,13 +161,19 @@ class SilverStripeContext extends MinkContext implements SilverStripeAwareContex
/**
* Returns a parameter map of state to set within the test session.
* Takes TESTSESSION_PARAMS environment variable into account for run-specific configurations.
*
* @return array
*/
public function getTestSessionState() {
return array(
'database' => $this->databaseName,
'mailer' => 'SilverStripe\BehatExtension\Utility\TestMailer',
$extraParams = array();
parse_str(getenv('TESTSESSION_PARAMS'), $extraParams);
return array_merge(
array(
'database' => $this->databaseName,
'mailer' => 'SilverStripe\BehatExtension\Utility\TestMailer',
),
$extraParams
);
}