piersb
piersb

Reputation: 598

PHPUnit stopped running

I've come back after the weekend to the following error:

Fatal error: Uncaught Error: Class 'PHPUnit\Runner\TestSuiteSorter' not found in /Users/piersb/Development/Den/dezeenjobs/_project/vendor/phpunit/phpunit/src/TextUI/TestRunner.php on line 1143

Error: Class 'PHPUnit\Runner\TestSuiteSorter' not found in /Users/piersb/Development/Den/dezeenjobs/_project/vendor/phpunit/phpunit/src/TextUI/TestRunner.php on line 1143

Call Stack:
    0.0030     403784   1. {main}() /Users/piersb/Development/Den/dezeenjobs/_project/vendor/phpunit/phpunit/phpunit:0
    0.0136     899376   2. PHPUnit\TextUI\Command::main() /Users/piersb/Development/Den/dezeenjobs/_project/vendor/phpunit/phpunit/phpunit:53
    0.0137     899488   3. PHPUnit\TextUI\Command->run() /Users/piersb/Development/Den/dezeenjobs/_project/vendor/phpunit/phpunit/src/TextUI/Command.php:155
    0.0519    2873464   4. PHPUnit\TextUI\TestRunner->doRun() /Users/piersb/Development/Den/dezeenjobs/_project/vendor/phpunit/phpunit/src/TextUI/Command.php:200
    0.0519    2873488   5. PHPUnit\TextUI\TestRunner->handleConfiguration() /Users/piersb/Development/Den/dezeenjobs/_project/vendor/phpunit/phpunit/src/TextUI/TestRunner.php:153


Process finished with exit code 255

But Google is giving me no helpful results on what TestSuiteSorter might be and why it's suddenly started playing up right now.

Have run composer update, no news there.

I did upgrade Wordpress and Woocommerce, but rolling back to a commit before that happened (one where tests were green) doesn't help; it just gives me a slightly different error message about TestSuiteSorter.

Warning: include(/Users/piersb/Development/Den/dezeenjobs/_project/vendor/composer/../phpunit/phpunit/src/Runner/TestSuiteSorter.php): failed to open stream: No such file or directory in /Users/piersb/Development/Den/dezeenjobs/_project/vendor/composer/ClassLoader.php on line 444

Does anyone have any leads?

New information: The commit that introduces the problem is when I switch from installing phpunit via the command line to installing it via composer. Checking the composer.json file, it looks like the version of phpunit being pulled in is coming in via a WP_Mock dependency.

The TestSuiteSorter class is being called by this version, but the file doesn't appear to exist.

Upvotes: 1

Views: 594

Answers (1)

piersb
piersb

Reputation: 598

In the end I updated my composer file requirements to this

{
    "require": {
        "intervention/image": "^2.3",
        "10up/wp_mock": "0.3.0",
        "phpunit/phpunit": "^7.2" // this is the new line
    }
}

then deleted my vendor directory and ran composer install and composer update.

Everything is now working. Huzzah!

Upvotes: 2

Related Questions