0

I'm trying to follow this guide https://www.sitepoint.com/using-selenium-with-phpunit/ so I can automate Chrome with PHP. I've already got this working in Python, but I'm just so much more familiar with PHP that I figured it'd be easier (maybe I'm wrong...)

Anyway, when I run

composer require --dev phpunit/phpunit
composer require --dev phpunit/phpunit-selenium

I got a whole ton of output from composer about how they both depend on different things that aren't possible to do at the same time (I think, I could be wrong here, too). My output:

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.

And this is my composer.json contents

{
    "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"
    }
}

1 Answer 1

2
composer require --dev phpunit/phpunit

This will install the latest PHPUnit, which currently is at version 6.x.

composer require --dev phpunit/phpunit-selenium

This will then try to install the selenium extension, which cannot be installed because it requires PHPUnit 5.x, as you can see reading the output you get as "Problem 1".

Solution: Explicitly require PHPUnit 5, then require phpunit-selenium.

As a side note: You gave the wrong composer.json, it cannot be created by the command you mentioned. It should have listed PHPUnit unter "require-dev".

Sign up to request clarification or add additional context in comments.

1 Comment

It looks like I just omitted the --dev flag on the first install, that's why it wasn't in the right spot. I had to look up how to require a specific version, so the command I ran (after removing phpunit) was php composer.phar require --dev phpunit/phpunit "^5" and it's all working!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.