我在为我的 laravel 项目设置 behat + mink 时遇到了很多麻烦。
错误消息:
PHP Deprecated: The ability to pass file names to Yaml::parse() was deprecated in 2.7
and will be removed in 3.0. Please, pass the contents of the file instead. in
home/user/projects/php/projectname/vendor/symfony/yaml/Symfony/Component/Yaml/Yaml.php
on line 58
[Behat\Testwork\ServiceContainer\Exception\ExtensionInitializationException]
`Behat\MinkExtensions\Extension` extension file or class could not be located.
我的composer.json:
"require": {
"laravel/framework": "4.2.*",
"behat/behat": "~3.0.6",
"behat/mink": "1.6.*",
"behat/mink-goutte-driver": "*",
"behat/mink-selenium-driver": "*",
"behat/mink-selenium2-driver": "*",
"behat/mink-sahi-driver": "*",
"behat/mink-zombie-driver": "*"
我的behat.yml(位于项目的根目录中)
default:
extensions:
Behat\MinkExtensions\Extension:
goutte: ~
我尝试了不同的版本,但仍然出现相同的错误消息。
我运行的命令是:
./vendor/bin/behat --init
./vendor/bin/behat
但产生相同的消息。
最佳答案
https://github.com/Behat/MinkExtension/blob/master/doc/index.rst
阅读上面的内容解决了问题,behat.yml 应该如下所示。
# behat.yml
default:
# ...
extensions:
Behat\MinkExtension:
base_url: 'http://example.com'
sessions:
default:
goutte: ~
关于php - Behat/mink/laravel 中缺少扩展名,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27410379/