Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document Behat support #80

Merged
merged 2 commits into from Apr 9, 2019
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
40 changes: 40 additions & 0 deletions README.md
Expand Up @@ -99,6 +99,46 @@ public function testMyTestCaseThatINeedToDebug()
}
```

### Behat

To use this bundle in a Behat test suite follow the installation instructions and add the following methods to your `FeatureContext` class:

```php
/**
* @BeforeSuite
*/
public static function beforeSuite()
{
StaticDriver::setKeepStaticConnections(true);
}

/**
* @BeforeScenario
*/
public function beforeScenario()
{
StaticDriver::beginTransaction();
}

/**
* @AfterScenario
*/
public function afterScenario()
{
StaticDriver::rollBack();
}

/**
* @AfterSuite
*/
public static function afterSuite()
{
StaticDriver::setKeepStaticConnections(false);
}
```

See [dmaicher/symfony-flex-behat-test](https://github.com/dmaicher/symfony-flex-behat-test) for a complete example.

### Troubleshooting

In case you are running (maybe without knowing it) queries during your tests that are implicitly committing any open transaction
Expand Down