我正在使用Symfony 2.0.15的作曲家並遷移到最新的Behat 2.4。這是我composer.json
:水貂痛風驅動程序。無法在Symfony 2.0上安裝fabpot/goutte
"require-dev": {
"behat/behat": "[email protected]",
"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"
- 從貝哈特\ CommonContexts \一步WebApiContext。當我僅使用MinkContext的步驟 - "Then the response status code should be 200"
它工作得很好。
最終答案是Behat\CommonContexts\WebApiContext
與Behat 2.4不兼容。
事實上,mink-browserkit-driver是Symfony2驅動程序的唯一要求,在大多數情況下,您使用BehatBundle。 – everzet
我現在不需要痛苦來滿足我的需求。如果我只使用mink-browserkit-driver,那麼我得到這個致命錯誤:在vendor/behat/mink-browserkit-driver/src/Behat/Mink/Driver/BrowserKitDriver中調用成員函數getUri() .php在第124行。這意味着瀏覽器不是我希望安裝goutte可以解決這個問題。任何想法如何解決它? –
你可以粘貼你的behat.yml嗎?你爲Symfony2擴展啓用了mink_driver嗎? –