-
-
Notifications
You must be signed in to change notification settings - Fork 192
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
getContext() method doesn't seem to exist #386
Comments
I traced this problem to line 70 of DrupalSubContextBase. It thinks $environment is a \Behat\Behat\Context\Environment\InitializedContextEnvironment, but it's actually \Behat\Testwork\Environment\Environment, which doesn't have the It doesn't look like that's changed in a long time though. |
I think this might be related to the Behat update that we did in the latest release. We were stuck on Behat 3.1 before. In Behat 3.2 a change was introduced that properly reinitializes Context classes at the start of every scenario and any code that relies on data being present in contexts from before the scenario started will now fail. Ref. Behat/Behat#758 I had a look at one of the contexts that threw a failure in the build that was linked, and it seems that this is the cause of the problem:
The This also seems like very inefficient code, since this will be executed at the start of every single scenario, even if the step definitions defined in the context are not even used in the scenario. Can you try changing this so the contexts are retrieved when they are actually being used instead of on the
|
I have proposed a PR that throws a more helpful exception, that will hopefully in the future help developers understand & debug this problem. Can you confirm if the |
@pfrenssen yes, moving the getContext calls out of @BeforeScenario fixed this. Thanks for the help. |
You're welcome! Glad to hear it has been fixed! |
Can somebody help me with this? If i tried somehow remove this call because of UninitializedContextEnvironment class then i have |
#390 might have helped with this too. |
Thank you very much, it seems that using |
After updating to Drupal Extension 3.3.0, I get this error when running acquia/lightning's tests:
Fatal error: Call to undefined method Behat\Behat\Context\Environment\UninitializedContextEnvironment::getContexts() in vendor/drupal/drupal-extension/src/Drupal/DrupalExtension/Context/DrupalSubContextBase.php on line 64
I'm not sure what's happening here -- any ideas would be welcome.
The text was updated successfully, but these errors were encountered: