Skip to content

"PHPUnit\TextUI\ResultPrinter" is internal and may change without further notice. #26

Closed

Description

@laceysanderson

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.

Activity

  1. mheap commented on Feb 28, 2021

    @mheap
    Owner

    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?

  2. wdoug commented on Jul 16, 2021

    @wdoug

    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

  3. mheap commented on Sep 6, 2021

    @mheap
    Owner

    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

  4. pinned this issue on Sep 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions