缺少Behat / mink / laravel的扩展名

时间:2014-12-10 20:38:44

标签: php laravel composer-php behat mink

我在为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

但产生同样的消息。

1 个答案:

答案 0 :(得分:2)

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: ~