Doesn't work with PHPUnit 9
Closed this issue ยท 6 comments
As #28 is not resolved this now doesn't work with PHPUnit 9.
We should fix it or limit the version constraint.
Hi,
In version 9 of PHPUnit, the printer needs to inherit from the class DefaultResultPrinter
(the namespace is PHPUnit\TextUI\DefaultResultPrinter
).
In this version the code is :
class PrettyPrinter extends ResultPrinter implements TestListener {}
And can be replaced by :
class PrettyPrinter extends DefaultResultPrinter {}
I don't know if the implementation change with version 9 and the documentation can be found here.
The latest release should work with PHPUnit 9.
Hello,
I see in this repo that the fix was implemented (https://github.com/indentno/phpunit-pretty-print/blob/develop/src/PrettyPrinter.php)
But the latest package available on packagist.org is 1.4.0 and is still incompatible with PHPUnit 9 (same error). I see in its source it doesn't contains the fix.
There are also no new release on this repository...
Can a new PHPUnit 9 compatible release be made please ?
Hello,
I see in this repo that the fix was implemented (https://github.com/indentno/phpunit-pretty-print/blob/develop/src/PrettyPrinter.php) But the latest package available on packagist.org is 1.4.0 and is still incompatible with PHPUnit 9 (same error). I see in its source it doesn't contains the fix. There are also no new release on this repository...
Can a new PHPUnit 9 compatible release be made please ?
Are you using the correct PrettyPrinter class? (The readme specifies that you should use the \Sempro\PHPUnitPrettyPrinter\PrettyPrinterForPhpUnit9 class for PHPUnit 9)
All my apologies, indeed it was well written in the README.md included in the package... but I missed it :/
In the phpunit XML config I changed the printerClass
from Sempro\PHPUnitPrettyPrinter\PrettyPrinter
to \Sempro\PHPUnitPrettyPrinter\PrettyPrinterForPhpUnit9
and now everything is OK ๐ฅณ
You can close this ticket again, sorry for the waste of time and many thanks for your quick answer ! (and by the way for this fantastic piece of code !!)
For future people like me, the information is now in this ticket O:)
But may I suggest also adding a PHPDoc block comment for the PrettyPrinter class, something like :
/**
* For PHPUnit9 you must use instead {@see PrettyPrinterForPhpUnit9}
*
* @deprecated 1.4.0
*
* @link https://github.com/indentno/phpunit-pretty-print/issues/32 Fix for PHPUnit9 compatibility
*/
All my apologies, indeed it was well written in the README.md included in the package... but I missed it :/
In the phpunit XML config I changed the
printerClass
fromSempro\PHPUnitPrettyPrinter\PrettyPrinter
to\Sempro\PHPUnitPrettyPrinter\PrettyPrinterForPhpUnit9
and now everything is OK ๐ฅณYou can close this ticket again, sorry for the waste of time and many thanks for your quick answer ! (and by the way for this fantastic piece of code !!)
For future people like me, the information is now in this ticket O:) But may I suggest also adding a PHPDoc block comment for the PrettyPrinter class, something like :
/** * For PHPUnit9 you must use instead {@see PrettyPrinterForPhpUnit9} * * @deprecated 1.4.0 * * @link https://github.com/indentno/phpunit-pretty-print/issues/32 Fix for PHPUnit9 compatibility */
No worries. Thank you for the kind words ๐
Feel free to send in a Pull Request with the changes you suggested!