Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PHPUnit 7.1.3 PactTestListener::addError declaration incompatible issue #79

Closed
macoto-liu opened this issue Jun 24, 2018 · 4 comments
Closed

Comments

@macoto-liu
Copy link

# vendor/bin/phpunit -version
PHPUnit 7.1.3 by Sebastian Bergmann and contributors.

I'm using phpunit 7.1.3, when setup the default PHPUnit listener in phpunit.xml. phpunit running failed because of addError declaration.

# composer test -- --debug
Do not run Composer as root/super user! See https://getcomposer.org/root for details
> vendor/bin/phpunit '--debug'

Fatal error: Declaration of PhpPact\Consumer\Listener\PactTestListener::addError(PHPUnit\Framework\Test $test, Exception $e, $time) must be compatible with PHPUnit\Framework\TestListener::addError(PHPUnit\Framework\Test $test, Throwable $t, float $time): void in /var/www/html/vendor/mattersight/phppact/src/PhpPact/Consumer/Listener/PactTestListener.php on line 23
@macoto-liu
Copy link
Author

I"m using "mattersight/phppact" : "3.1.1"

@mattermack
Copy link
Contributor

mattermack commented Jun 27, 2018

I validated this. It appears we run on PHPUnit 6.X but not 7.X without changes.

PHPUnit Version Result
6.5.8 Pass
7.1.3 Fail
7.2.6 Fail

PHP Version: 7.2.1

@mattermack
Copy link
Contributor

mattermack commented Jun 27, 2018

Funny enough, the PHPUnit 7.1 documetation says to use \Exception, rather than \Throwable
https://phpunit.readthedocs.io/en/7.1/extending-phpunit.html?highlight=addError

But the code (https://github.com/sebastianbergmann/phpunit/blob/d96549ddd7925645d069de0bdd786fb365c0c372/src/Framework/TestListener.php#L20) says Throwable.

Here is the change in PHPUnit: sebastianbergmann/phpunit#2566

@mattermack
Copy link
Contributor

I merged this into dev-master. Because this requires an upgrade to PHP (7.1) and a major upgraded of PHPUnit 7.X, PactPHP will become 4.0.0. I'd love your feedback.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants