Call to a member function getSession() on a non-object in vendor/behat/mink-extension/src/Behat/MinkExtension/Context/RawMinkContext.php on line 81

匆匆过客 提交于 2019-11-29 18:05:42

Make sure your behat.yml file is in the correct location. It should be in the root of your project, not in any subdirectories.

If the advice of Stuart Grimshaw doesn't owrk, it can be because of two reasons :

  1. Your composer.json configuration is not correct; it is tricky to get the correct versions of the 5 or 6 different modules that are needed to make Mink, Behat, Goutte, Selenium, Zombie, maybe Symfony2.. all work together; so please check manually, in each composer.json of those extensions, the required versions of other components; also, try not to use mink-bundle, whose versions of required dependancies seem old
  2. Do not run the bin\behat command (under Windows or Linux) from your bundle directory; otherwise the .yml configuration file is not found (for sure some obscure reason related to relative paths). You should run the bin\behat command from the root of your project (run the cd command to it first
Ahad Ali

I was getting a similar fatal error as well

PHP Fatal error:  Call to a member function getSession() on a non-object in /home/ahad/sites/symfony/vendor/behat/mink-extension/src/Behat/MinkExtension/Context/RawMinkContext.php on line 101

I have put my answer over here Struggling to get Mink working with Behat

Which solved my problem.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!