Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PhpStorm 2016.3.3 does not find test class with PHPUnit 6.0.*

I want to run PHPUnit 6.0.* tests in PhpStorm. But it shows me the following error when I want to execute tests of a single class: "Test class is not specified or invalid".

Run/Debug Configuration with error message

I loaded PHPUnit with Composer. Here the composer.json content:

{
  "require": {
    "phpunit/phpunit": "6.0.0"
  }
}

Running the test in the command line is working. Output:

/usr/bin/php7.1 /path/to/project/vendor/phpunit/phpunit/phpunit --no-configuration MyTestTest /path/to/project/Tests/MyTestTest.php
PHPUnit 6.0.0 by Sebastian Bergmann and contributors.

.                                                                   1 / 1 (100%)

Time: 29 ms, Memory: 2.00MB

OK (1 test, 1 assertion)

Some additional information:

  • PhpStorm settings:
    • PHP language level: 7.1
    • CLI interpreter: 7.1
    • PHPUnit uses Composer autoloader (link to autoload.php)
  • PhpStorm Version: 2016.3.3

Tested it with 6.0.0 and 6.0.10. Assuming that all 6.0.* version are affected.

If I switch the version to 5.7.17 (last version before 6.0.0), it is working. And as I mentioned, it is working when I select all tests in a directory, just not when I want to test a class or a method (error is the same).

Do I have a misconfiguration? Or is it PhpStorm bug?

I am attaching a minimal working example project for PhpStorm. Minimal working example PhpStorm project

It would be interesting if somebody could reproduce this issue with it or not.

like image 413
Simon Lang Avatar asked Oct 17 '22 15:10

Simon Lang


1 Answers

Support for PhpUnit 6 will be in PhpStorm 2017.1. You can get Release Candidate version of it. https://www.jetbrains.com/phpstorm/nextversion/index.html

like image 194
Vini Avatar answered Oct 21 '22 05:10

Vini