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

Doesn't work with PHPUnit 9 #32

Closed
MLDMoritz opened this issue Mar 22, 2020 · 6 comments
Closed

Doesn't work with PHPUnit 9 #32

MLDMoritz opened this issue Mar 22, 2020 · 6 comments

Comments

@MLDMoritz
Copy link
Contributor

As #28 is not resolved this now doesn't work with PHPUnit 9.

We should fix it or limit the version constraint.

@niquenen
Copy link

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.

@ventrec
Copy link
Member

ventrec commented Sep 11, 2020

The latest release should work with PHPUnit 9.

@ventrec ventrec closed this as completed Sep 11, 2020
@piRGoif
Copy link
Contributor

piRGoif commented Jan 6, 2023

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 ?

@ventrec ventrec reopened this Jan 6, 2023
@ventrec
Copy link
Member

ventrec commented Jan 6, 2023

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)

@piRGoif
Copy link
Contributor

piRGoif commented Jan 6, 2023

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
 */

@ventrec
Copy link
Member

ventrec commented Jan 6, 2023

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
 */

No worries. Thank you for the kind words 🙂

Feel free to send in a Pull Request with the changes you suggested!

@ventrec ventrec closed this as completed Jan 6, 2023
piRGoif pushed a commit to piRGoif/phpunit-pretty-print that referenced this issue Jan 6, 2023
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

4 participants