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

Fails with PHPUnit 7.5: Cannot access private property $anyBarEnabled #169

Closed
mbrodala opened this issue Sep 23, 2020 · 3 comments
Closed

Comments

@mbrodala
Copy link
Contributor

With PHPUnit 7.5 the result printer fails:

PHPUnit Pretty Result Printer 0.28.0 by Codedungeon and contributors.
==> Configuration: /var/www/html/vendor/codedungeon/phpunit-result-printer/src/phpunit-printer.yml

PHPUnit 7.5.20 by Sebastian Bergmann and contributors.


 ==> FooTest        ✔  ✔  ✔  ✔  

Time: 64 ms, Memory: 10.00 MB

OK (10 tests, 14 assertions)
PHP Fatal error:  Uncaught Error: Cannot access private property Codedungeon\PHPUnitPrettyResultPrinter\Printer::$anyBarEnabled in /var/www/html/vendor/codedungeon/phpunit-result-printer/src/ResultPrinter71.php:42
Stack trace:
#0 /var/www/html/vendor/phpunit/phpunit/src/TextUI/ResultPrinter.php(194): Codedungeon\PHPUnitPrettyResultPrinter\ResultPrinter71->printFooter(Object(PHPUnit\Framework\TestResult))
#1 /var/www/html/vendor/phpunit/phpunit/src/TextUI/TestRunner.php(663): PHPUnit\TextUI\ResultPrinter->printResult(Object(PHPUnit\Framework\TestResult))
#2 /var/www/html/vendor/phpunit/phpunit/src/TextUI/Command.php(206): PHPUnit\TextUI\TestRunner->doRun(Object(PHPUnit\Framework\TestSuite), Array, true)
#3 /var/www/html/vendor/phpunit/phpunit/src/TextUI/Command.php(162): PHPUnit\TextUI\Command->run(Array, true)
#4 /var/www/html/vendor/phpunit/phpunit/phpunit(61): PHPUnit\TextUI\Command::main()
#5 {main}
  thrown in /var/www/html/vendor/codedungeon/phpunit-result-printer/src/ResultPrinter71.php on line 42

Fatal error: Uncaught Error: Cannot access private property Codedungeon\PHPUnitPrettyResultPrinter\Printer::$anyBarEnabled in /var/www/html/vendor/codedungeon/phpunit-result-printer/src/ResultPrinter71.php:42
Stack trace:
#0 /var/www/html/vendor/phpunit/phpunit/src/TextUI/ResultPrinter.php(194): Codedungeon\PHPUnitPrettyResultPrinter\ResultPrinter71->printFooter(Object(PHPUnit\Framework\TestResult))
#1 /var/www/html/vendor/phpunit/phpunit/src/TextUI/TestRunner.php(663): PHPUnit\TextUI\ResultPrinter->printResult(Object(PHPUnit\Framework\TestResult))
#2 /var/www/html/vendor/phpunit/phpunit/src/TextUI/Command.php(206): PHPUnit\TextUI\TestRunner->doRun(Object(PHPUnit\Framework\TestSuite), Array, true)
#3 /var/www/html/vendor/phpunit/phpunit/src/TextUI/Command.php(162): PHPUnit\TextUI\Command->run(Array, true)
#4 /var/www/html/vendor/phpunit/phpunit/phpunit(61): PHPUnit\TextUI\Command::main()
#5 {main}
  thrown in /var/www/html/vendor/codedungeon/phpunit-result-printer/src/ResultPrinter71.php on line 42
Script phpunit --colors=always handling the test:unit event returned with error code 255

The installed packages:

$ composer show "*phpunit*"
codedungeon/phpunit-result-printer 0.29.1 PHPUnit Pretty Result Printer
phpunit/php-code-coverage          6.1.4  Library that provides collection, processing, and rendering functionality for PHP code coverage information.
phpunit/php-file-iterator          2.0.2  FilterIterator implementation that filters files based on a list of suffixes.
phpunit/php-text-template          1.2.1  Simple template engine.
phpunit/php-timer                  2.1.2  Utility class for timing
phpunit/php-token-stream           3.1.1  Wrapper around PHP's tokenizer extension.
phpunit/phpunit                    7.5.20 The PHP Unit Testing framework.

If I move the use PrinterTrait from Printer.php to ResultPrinter71.php the issue is gone. I'd recommend doing that anyways since it makes the code way easier to follow.

@mikeerickson
Copy link
Owner

@mbrodala thank you for the recommendation, I will take a peek at this today and get a fix posted.

@mbrodala
Copy link
Contributor Author

Thanks for the hotfix!

@mikeerickson
Copy link
Owner

No problem, sorry for the issue 🤓

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