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

Application state not refreshed between scenarios #76

Open
ecornelisse opened this issue Mar 28, 2018 · 3 comments
Open

Application state not refreshed between scenarios #76

ecornelisse opened this issue Mar 28, 2018 · 3 comments

Comments

@ecornelisse
Copy link

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?

@ecornelisse ecornelisse changed the title Applkcation state not refreshed between scenarios Application state not refreshed between scenarios Mar 28, 2018
@ecornelisse
Copy link
Author

ecornelisse commented Mar 29, 2018

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?

@ecornelisse
Copy link
Author

ecornelisse commented Mar 29, 2018

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

@CocoJr
Copy link

CocoJr commented Jul 16, 2021

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants