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\TextUI\ResultPrinter" is internal and may change without further notice. #26

Closed
laceysanderson opened this issue Jan 14, 2021 · 3 comments

Comments

@laceysanderson
Copy link

Hello, I Love this printer! We just recently updated to PHPUnit 8.5.13 and started receiving errors in our github actions due to your printer. You can see here that the tests all pass beautifully using your printer with phpunit 7.5.10 but that the exact same tests on the same code show the following warning on the updated phpunit:

PHPUnit 8.5.13 by Sebastian Bergmann and contributors.

Testing 

Other deprecation notices (2)

  2x: The "PHPUnit\TextUI\ResultPrinter" class is considered internal This class is not covered by the backward compatibility promise for PHPUnit. It may change without further notice. You should not use it from "mheap\GithubActionsReporter\Printer8".

Error: Process completed with exit code 1.

We are stuck with the updated phpunit version due to a dependency on Drupal for our project.

@mheap
Copy link
Owner

mheap commented Feb 28, 2021

Hey @laceysanderson! It's been a while but I finally found time to sit down and investigate this. Whilst we do depend on an internal class, I'm not sure what the alternative is here.

I tried to reproduce your issue and the error shown isn't produced by the printer or by PHPUnit. I bootstrapped a test project with the following:

"require-dev": {
    "phpunit/phpunit": "8.5.13",
    "mheap/phpunit-github-actions-printer": "^1.5"
}

And when I ran the tests:

./vendor/bin/phpunit --printer mheap\\GithubActionsReporter\\Printer tests
PHPUnit 8.5.13 by Sebastian Bergmann and contributors.

::error file=tests/EmailTest.php,line=10::Failed asserting that 'Foo' is an instance of class "Email".

Are you running any static analysis tools that could be impacting the build?

@wdoug
Copy link

wdoug commented Jul 16, 2021

If I'm reading this correctly, it seems like there might have been an update so this is now an interface instead of a class that needs to be extended

@mheap
Copy link
Owner

mheap commented Sep 6, 2021

I've just taken another pass at this and it looks as though it's to do with Symfony's PHPUnit bridge (thanks for the link @wdoug)!

Unfortunately in PHPUnit 8 I have to extend the ResultPrinter class even though it's internal

From Sebastien:

With that out of the way, yes, the fact that PHPUnit\TextUI\ResultPrinter is marked @internal is a problem. Its implementation is, and should stay, internal. However, for legacy reasons, it is also a public API as extending this class is an intended way for augmenting or changing the output printed by PHPUnit.

This issue was resolved by the addition of DefaultResultPrinter in PHPUnit 9, which this printer extends.

I think the only solution here is to switch to PHPUnit 9, or run PHPUnit without using the Symfony bridge. In the mean time, I'll close and pin this issue in case it helps anyone else in the future

@mheap mheap closed this as completed Sep 6, 2021
@mheap mheap pinned this issue Sep 6, 2021
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

3 participants