symfony / test-pack

A Symfony Pack for functional testing
MIT License
857 stars 9 forks source link

Version 1.0.8 requires phpunit directly, breaking simple phpunit #13

Closed Nemo64 closed 3 years ago

Nemo64 commented 3 years ago

I just ran a composer update in a symfony 4.4 project and it upgraded this test pack from 1.0.7 to 1.0.8. 1.0.8 requires phpunit directly, which results in it being installed into the vendor folder.

This then causes issues when running the simple-phpunit script which installs a seperate phpunit version outside the usual vendor folder. It causes errors like these:

Symfony\Component\ErrorHandler\Error\UndefinedMethodError {#15648
  #message: "Attempted to call an undefined method named "doRun" of class "PHPUnit\TextUI\TestRunner"."
  #code: 0
  #file: "./bin/.phpunit/phpunit-7.5-0/src/TextUI/Command.php"
  #line: 206
  trace: {
    ./bin/.phpunit/phpunit-7.5-0/src/TextUI/Command.php:206 {
      PHPUnit\TextUI\Command->run(array $argv, bool $exit = true): int
      › try {
      ›     $result = $runner->doRun($suite, $this->arguments, $exit);
      › } catch (Exception $e) {
    }
    ./bin/.phpunit/phpunit-7.5-0/src/TextUI/Command.php:162 { …}
    ./bin/.phpunit/phpunit-7.5-0/phpunit:22 { …}
    ./vendor/symfony/phpunit-bridge/bin/simple-phpunit.php:435 { …}
    ./bin/phpunit.php:13 { …}
  }
}

I worked around this by declaring

    "conflict": {
        // [...]
        "phpunit/phpunit": "*"
    },

This prevents the newer test-pack from being installed.

nicolas-grekas commented 3 years ago

Thanks for the report. Closing as duplicate of #12.