我试图遵循本指南https://www.sitepoint.com/using-selenium-with-phpunit/,因此我可以使用PHP自动执行Chrome。我已经用Python工作了,但是我对PHP更加熟悉,我觉得它更容易(也许我错了......)
无论如何,当我跑步时
composer require --dev phpunit/phpunit
composer require --dev phpunit/phpunit-selenium
我从作曲家那里得到了大量的关于他们如何依赖于同时不可能完成的不同事情的输出(我想,我也可能在这里错了)。我的输出:
Your requirements could not be resolved to an installable set of packages.
Problem 1
- phpunit/phpunit-selenium 3.0.3 requires phpunit/phpunit ~5.0 -> satisfiable by phpunit/phpunit[5.0.0, 5.0.1, 5.0.10, 5.0.2, 5.0.3, 5.0.4, 5.0.5, 5.0.6, 5.0.7, 5.0.8, 5.0.9, 5.0.x-dev, 5.1.0, 5.1.1, 5.1.2, 5.1.3, 5.1.4, 5.1.5, 5.1.6, 5.1.7, 5.1.x-dev, 5.2.0, 5.2.1, 5.2.10, 5.2.11, 5.2.12, 5.2.2, 5.2.3, 5.2.4, 5.2.5, 5.2.6, 5.2.7, 5.2.8, 5.2.9, 5.2.x-dev, 5.3.0, 5.3.1, 5.3.2, 5.3.3, 5.3.4, 5.3.5, 5.3.x-dev, 5.4.0, 5.4.1, 5.4.2, 5.4.3, 5.4.4, 5.4.5, 5.4.6, 5.4.7, 5.4.8, 5.4.x-dev, 5.5.0, 5.5.1, 5.5.2, 5.5.3, 5.5.4, 5.5.5, 5.5.6, 5.5.7, 5.5.x-dev, 5.6.0, 5.6.1, 5.6.2, 5.6.3, 5.6.4, 5.6.5, 5.6.6, 5.6.7, 5.6.8, 5.6.x-dev, 5.7.0, 5.7.1, 5.7.10, 5.7.11, 5.7.12, 5.7.13, 5.7.14, 5.7.15, 5.7.16, 5.7.17, 5.7.18, 5.7.19, 5.7.2, 5.7.20, 5.7.3, 5.7.4, 5.7.5, 5.7.6, 5.7.7, 5.7.8, 5.7.9, 5.7.x-dev] but these conflict with your requirements or minimum-stability.
- phpunit/phpunit-selenium 3.0.2 requires phpunit/phpunit ~5.0 -> satisfiable by phpunit/phpunit[5.0.0, 5.0.1, 5.0.10, 5.0.2, 5.0.3, 5.0.4, 5.0.5, 5.0.6, 5.0.7, 5.0.8, 5.0.9, 5.0.x-dev, 5.1.0, 5.1.1, 5.1.2, 5.1.3, 5.1.4, 5.1.5, 5.1.6, 5.1.7, 5.1.x-dev, 5.2.0, 5.2.1, 5.2.10, 5.2.11, 5.2.12, 5.2.2, 5.2.3, 5.2.4, 5.2.5, 5.2.6, 5.2.7, 5.2.8, 5.2.9, 5.2.x-dev, 5.3.0, 5.3.1, 5.3.2, 5.3.3, 5.3.4, 5.3.5, 5.3.x-dev, 5.4.0, 5.4.1, 5.4.2, 5.4.3, 5.4.4, 5.4.5, 5.4.6, 5.4.7, 5.4.8, 5.4.x-dev, 5.5.0, 5.5.1, 5.5.2, 5.5.3, 5.5.4, 5.5.5, 5.5.6, 5.5.7, 5.5.x-dev, 5.6.0, 5.6.1, 5.6.2, 5.6.3, 5.6.4, 5.6.5, 5.6.6, 5.6.7, 5.6.8, 5.6.x-dev, 5.7.0, 5.7.1, 5.7.10, 5.7.11, 5.7.12, 5.7.13, 5.7.14, 5.7.15, 5.7.16, 5.7.17, 5.7.18, 5.7.19, 5.7.2, 5.7.20, 5.7.3, 5.7.4, 5.7.5, 5.7.6, 5.7.7, 5.7.8, 5.7.9, 5.7.x-dev] but these conflict with your requirements or minimum-stability.
- phpunit/phpunit-selenium 3.0.1 requires phpunit/phpunit ~5.0 -> satisfiable by phpunit/phpunit[5.0.0, 5.0.1, 5.0.10, 5.0.2, 5.0.3, 5.0.4, 5.0.5, 5.0.6, 5.0.7, 5.0.8, 5.0.9, 5.0.x-dev, 5.1.0, 5.1.1, 5.1.2, 5.1.3, 5.1.4, 5.1.5, 5.1.6, 5.1.7, 5.1.x-dev, 5.2.0, 5.2.1, 5.2.10, 5.2.11, 5.2.12, 5.2.2, 5.2.3, 5.2.4, 5.2.5, 5.2.6, 5.2.7, 5.2.8, 5.2.9, 5.2.x-dev, 5.3.0, 5.3.1, 5.3.2, 5.3.3, 5.3.4, 5.3.5, 5.3.x-dev, 5.4.0, 5.4.1, 5.4.2, 5.4.3, 5.4.4, 5.4.5, 5.4.6, 5.4.7, 5.4.8, 5.4.x-dev, 5.5.0, 5.5.1, 5.5.2, 5.5.3, 5.5.4, 5.5.5, 5.5.6, 5.5.7, 5.5.x-dev, 5.6.0, 5.6.1, 5.6.2, 5.6.3, 5.6.4, 5.6.5, 5.6.6, 5.6.7, 5.6.8, 5.6.x-dev, 5.7.0, 5.7.1, 5.7.10, 5.7.11, 5.7.12, 5.7.13, 5.7.14, 5.7.15, 5.7.16, 5.7.17, 5.7.18, 5.7.19, 5.7.2, 5.7.20, 5.7.3, 5.7.4, 5.7.5, 5.7.6, 5.7.7, 5.7.8, 5.7.9, 5.7.x-dev] but these conflict with your requirements or minimum-stability.
- phpunit/phpunit-selenium 3.0.0 requires phpunit/phpunit ~5 -> satisfiable by phpunit/phpunit[5.0.0, 5.0.1, 5.0.10, 5.0.2, 5.0.3, 5.0.4, 5.0.5, 5.0.6, 5.0.7, 5.0.8, 5.0.9, 5.0.x-dev, 5.1.0, 5.1.1, 5.1.2, 5.1.3, 5.1.4, 5.1.5, 5.1.6, 5.1.7, 5.1.x-dev, 5.2.0, 5.2.1, 5.2.10, 5.2.11, 5.2.12, 5.2.2, 5.2.3, 5.2.4, 5.2.5, 5.2.6, 5.2.7, 5.2.8, 5.2.9, 5.2.x-dev, 5.3.0, 5.3.1, 5.3.2, 5.3.3, 5.3.4, 5.3.5, 5.3.x-dev, 5.4.0, 5.4.1, 5.4.2, 5.4.3, 5.4.4, 5.4.5, 5.4.6, 5.4.7, 5.4.8, 5.4.x-dev, 5.5.0, 5.5.1, 5.5.2, 5.5.3, 5.5.4, 5.5.5, 5.5.6, 5.5.7, 5.5.x-dev, 5.6.0, 5.6.1, 5.6.2, 5.6.3, 5.6.4, 5.6.5, 5.6.6, 5.6.7, 5.6.8, 5.6.x-dev, 5.7.0, 5.7.1, 5.7.10, 5.7.11, 5.7.12, 5.7.13, 5.7.14, 5.7.15, 5.7.16, 5.7.17, 5.7.18, 5.7.19, 5.7.2, 5.7.20, 5.7.3, 5.7.4, 5.7.5, 5.7.6, 5.7.7, 5.7.8, 5.7.9, 5.7.x-dev] but these conflict with your requirements or minimum-stability.
- Installation request for phpunit/phpunit-selenium ^3.0 -> satisfiable by phpunit/phpunit-selenium[3.0.0, 3.0.1, 3.0.2, 3.0.3].
Installation failed, reverting ./composer.json to its original content.
这是我的composer.json
内容
{
"require": {
"giggsey/libphonenumber-for-php": "~7.0",
"firephp/firephp-core": "0.4.0",
"aws/aws-sdk-php": "^3.3",
"jdorn/sql-formatter": "^1.2",
"piwik/device-detector": "3.5.0",
"doctrine/cache": "1.6.0",
"php-console/php-console": "~3.0",
"gabrielbull/ups-api": "^0.7.3",
"google/apiclient": "^2.0",
"jeremeamia/superclosure": "^2.3",
"commerceguys/addressing": "^0.8.4",
"arcreative/php-address-format": "^0.0.2",
"commerceguys/intl": "^0.7.4",
"ramsey/uuid": "^3.6",
"neitanod/forceutf8": "^2.0",
"facebook/webdriver": "^1.4",
"phpunit/phpunit": "^6.2"
}
}
答案 0 :(得分:2)
composer require --dev phpunit/phpunit
这将安装最新的PHPUnit,目前版本为6.x。
composer require --dev phpunit/phpunit-selenium
然后尝试安装selenium扩展,因为它需要PHPUnit 5.x而无法安装,因为您可以看到读取的输出为"问题1"。
解决方案:明确要求PHPUnit 5,然后需要phpunit-selenium。
作为旁注:你给出了错误的composer.json
,它不能通过你提到的命令创建。它应该列出PHPUnit unter "require-dev"
。