Behat-Laravel-Extension
Behat-Laravel-Extension copied to clipboard
Application state not refreshed between scenarios
The application instance is not refreshed and so singleton services are being reused during different scenarios. This can be a problem if the singelton has some for of state. How can i refresh the application completely on each scenario?
you are stating in the readme:
Refresh: Laravel is automatically rebooted after each scenario (so nothing like user sessions will be persisted).
But i guess that's not a complete refresh of the laravel Application?
i think i found the problem. The reboot is only being done if the Context if instanceoff KernelAwareContext. Since i use multiple context files that no longer works because the last context file is of a different type. Maybe i can create a pull request with support for multiple context files
Got the same problem. To fix that, I have a context extending MinkContext
. I have implement the KernelAwareContext
and use the trait App
:
<?php
use Behat\MinkExtension\Context\MinkContext;
use Laracasts\Behat\Context\App;
use Laracasts\Behat\Context\KernelAwareContext;
class CustomContext extends MinkContext implements KernelAwareContext
{
use App;
....
}
Put your context at the end of the list in the behat configuration file.