我正在使用带有 Symfony 2.0.15 的作曲家并迁移到最新的 Behat 2.4。这是在我的composer.json
:
"require-dev": {
"behat/behat": "2.4@stable",
"behat/mink-extension": "*",
"behat/symfony2-extension": "*",
"behat/mink-browserkit-driver": "*",
"behat/mink-goutte-driver": "dev-master",
"behat/common-contexts": "*",
"kriswallsmith/buzz": ">=0.5.0"
}
我跑:php composer.phar update --dev
并且有一个错误:
Your requirements could not be solved to an installable set of packages.
Problem 1
- Installation request for behat/mink-goutte-driver dev-master -> satisfiable by behat/mink-goutte-driver dev-master.
- don't install fabpot/goutte 1.0.x-dev|install fabpot/goutte dev-master
- behat/mink-goutte-driver dev-master requires fabpot/goutte 1.0.* -> satisfiable by fabpot/goutte 1.0.x-dev.
- Conclusion: remove symfony/symfony v2.0.15
- fabpot/goutte dev-master requires symfony/dom-crawler 2.1.* -> satisfiable by symfony/symfony 2.1.x-dev, symfony/dom-crawler v2.1.0-BETA1, symfony/dom-crawler 2.1.x-dev, symfony/symfony v2.1.0-BETA1.
- Can only install one of: symfony/symfony v2.0.15, symfony/symfony 2.1.x-dev.
- Can only install one of: symfony/symfony v2.1.0-BETA1, symfony/symfony v2.0.15.
- don't install symfony/symfony v2.0.15|don't install symfony/dom-crawler v2.1.0-BETA1
- don't install symfony/dom-crawler 2.1.x-dev|don't install symfony/symfony v2.0.15
- Installation request for symfony/symfony == 2.0.15.0 -> satisfiable by symfony/symfony v2.0.15.
如果我正确理解了这个错误,那是因为fabpot/goutte
包依赖于 Symfony 2.1 包并且不适用于 Symfony 2.0。纠正我,如果我错了。
这是我的behat.yml
:
default:
formatter:
parameters:
paths: false
context:
class: 'Site\PublicBundle\Features\Context\FeatureContext'
parameters:
base_url: 'http://test-anton.site.com'
extensions:
Behat\Symfony2Extension\Extension:
mink_driver: true
bundle: 'PublicBundle'
kernel:
env: test
debug: true
Behat\MinkExtension\Extension:
default_session: symfony2
base_url: 'http://test-anton.site.com'
这是我失败场景的示例:
Scenario: User can view homepage
When I go to "/"
Then the response code should be 200
"When I go to"
- 是 MinkContext 步骤,但"Then the response code should be 200"
- 是来自 Behat\CommonContexts\WebApiContext 的步骤。当我只使用 MinkContext 中的步骤时 -"Then the response status code should be 200"
它工作得很好。
最后的答案是Behat\CommonContexts\WebApiContext
与 Behat 2.4 不兼容。