mikeerickson / phpunit-pretty-result-printer Goto Github PK
View Code? Open in Web Editor NEWPHPUnit Pretty Result Printer -- make your PHPUnit tests look pretty!
License: MIT License
PHPUnit Pretty Result Printer -- make your PHPUnit tests look pretty!
License: MIT License
This was available in an earlier version, restore this and update anybar
if it is installed
I have an issue when running unit tests that generate code coverage, and this started to happen after I added this package.
I get the following message
[Symfony\Component\Process\Exception\ProcessTimedOutException]
The process "'/usr/local/Cellar/php/7.2.4_1/bin/php' -d allow_url_fopen='1' -d disable_functions='' -d memory_limit='1536M' vendor/bin/phpunit -c phpunit-unit.xml.dist" exce
eded the timeout of 300 seconds.
The unit test that I run without code coverage passes, and I get the nice checkmarks and all, but the one with code coverage fails like this.
Is there a flag I can use not to use the pretty printer when generating test coverage?
EDIT: I increased the memory limit to 2048M and I still get this issue.
Hi,
I got this error when I tried to run phpunit with the package:
Uncaught Error: Class 'PHPUnit\Runner\Version' not found in codedungeon/phpunit-result-printer/src/Printer.php on line 15
Config:
Can anyone can help with this?
Consider moving CI tool from CircleCI to TravisCI
I'm getting this warning when installing/updating composer:
Is there a way to fix this?
php 7.2.4 (brew)
Laravel 5.6 (phpunit ~7.0)
Warning: Ambiguous class resolution, "Codedungeon\PHPUnitPrettyResultPrinter\_ResultPrinter" was found in both "/Users/tobyevans/Code/dovetailx/api.dovetailx/vendor/codedungeon/phpunit-result-printer/src/ResultPrinter5.php" and "/Users/tobyevans/Code/dovetailx/api.dovetailx/vendor/codedungeon/phpunit-result-printer/src/ResultPrinter6.php", the first will be used.
Warning: Ambiguous class resolution, "Codedungeon\PHPUnitPrettyResultPrinter\_ResultPrinter" was found in both "/Users/tobyevans/Code/dovetailx/api.dovetailx/vendor/codedungeon/phpunit-result-printer/src/ResultPrinter5.php" and "/Users/tobyevans/Code/dovetailx/api.dovetailx/vendor/codedungeon/phpunit-result-printer/src/ResultPrinter70.php", the first will be used.
Warning: Ambiguous class resolution, "Codedungeon\PHPUnitPrettyResultPrinter\_ResultPrinter" was found in both "/Users/tobyevans/Code/dovetailx/api.dovetailx/vendor/codedungeon/phpunit-result-printer/src/ResultPrinter5.php" and "/Users/tobyevans/Code/dovetailx/api.dovetailx/vendor/codedungeon/phpunit-result-printer/src/ResultPrinter71.php", the first will be used.
I'm getting the following error when using PHPUnit ~7.0 and the latest version of this package, is their something maybe I have wrong? Or is this a change in 7.0 that breaks this lib?
PHP Fatal error: Declaration of Codedungeon\PHPUnitPrettyResultPrinter\_ResultPrinter::startTest(PHPUnit\Framework\Test $test) must be compatible with PHPUnit\TextUI\ResultPrinter::startTest(PHPUnit\Framework\Test $test): void in /home/vagrant/code/Work/Help-Desk/vendor/codedungeon/phpunit-result-printer/src/Printer.php on line 22
Fatal error: Declaration of Codedungeon\PHPUnitPrettyResultPrinter\_ResultPrinter::startTest(PHPUnit\Framework\Test $test) must be compatible with PHPUnit\TextUI\ResultPrinter::startTest(PHPUnit\Framework\Test $test): void in /home/vagrant/code/Work/Help-Desk/vendor/codedungeon/phpunit-result-printer/src/Printer.php on line 22
I have two tests:
final class FirstFileTest extends \PHPUnit\Framework\TestCase
{
public function test_first_test()
{
$this->assertTrue(true);
}
public function test_second_test()
{
$this->assertTrue(true);
}
}
And:
final class SecondFileTest extends \PHPUnit\Framework\TestCase
{
public function test_third_test()
{
$this->assertTrue(false); // failure
}
public function test_fourth_test()
{
$this->assertTrue(true);
}
}
The output is as follows:
==> FirstFileTest ✓ ✓ ✖
==> SecondFileTest ✓
I have done this with another project and need to migrate that code to this repo
I just installed in my fresh new project. Works well. Thanks so much.
But it also sends a bunch of warnings.
$ ./vendor/bin/phpunit --printer=Codedungeon\\PHPUnitPrettyResultPrinter\\Printer
PHP Warning: Declaration of Codedungeon\PHPUnitPrettyResultPrinter\_ResultPrinter::writeProgress(string $progress): void should be compatible with PHPUnit\TextUI\ResultPrinter::writeProgress($progress): void in project\vendor\codedungeon\phpunit-result-printer\src\Printer.php on line 23
PHP Stack trace:
PHP 1. {main}() project\vendor\phpunit\phpunit\phpunit:0
PHP 2. PHPUnit\TextUI\Command::main() project\vendor\phpunit\phpunit\phpunit:53
PHP 3. PHPUnit\TextUI\Command->run() project\vendor\phpunit\phpunit\src\TextUI\Command.php:153
PHP 4. PHPUnit\TextUI\Command->handleArguments() project\vendor\phpunit\phpunit\src\TextUI\Command.php:169
PHP 5. PHPUnit\TextUI\Command->handlePrinter() project\vendor\phpunit\phpunit\src\TextUI\Command.php:861
PHP 6. class_exists() project\vendor\phpunit\phpunit\src\TextUI\Command.php:948
PHP 7. spl_autoload_call() project\vendor\phpunit\phpunit\src\TextUI\Command.php:948
PHP 8. Composer\Autoload\ClassLoader->loadClass() project\vendor\phpunit\phpunit\src\TextUI\Command.php:948
PHP 9. Composer\Autoload\includeFile() project\vendor\composer\ClassLoader.php:322
PHP 10. include() project\vendor\composer\ClassLoader.php:444
Warning: Declaration of Codedungeon\PHPUnitPrettyResultPrinter\_ResultPrinter::writeProgress(string $progress): void should be compatible with PHPUnit\TextUI\ResultPrinter::writeProgress($progress): void in project\vendor\codedungeon\phpunit-result-printer\src\Printer.php on line 23
Call Stack:
0.2457 353128 1. {main}() project\vendor\phpunit\phpunit\phpunit:0
0.3309 2189864 2. PHPUnit\TextUI\Command::main() project\vendor\phpunit\phpunit\phpunit:53
0.3309 2194424 3. PHPUnit\TextUI\Command->run() project\vendor\phpunit\phpunit\src\TextUI\Command.php:153
0.3309 2194424 4. PHPUnit\TextUI\Command->handleArguments() project\vendor\phpunit\phpunit\src\TextUI\Command.php:169
0.8292 4101208 5. PHPUnit\TextUI\Command->handlePrinter() project\vendor\phpunit\phpunit\src\TextUI\Command.php:861
0.8297 4103360 6. class_exists() project\vendor\phpunit\phpunit\src\TextUI\Command.php:948
0.8297 4103424 7. spl_autoload_call() project\vendor\phpunit\phpunit\src\TextUI\Command.php:948
0.8297 4103488 8. Composer\Autoload\ClassLoader->loadClass() project\vendor\phpunit\phpunit\src\TextUI\Command.php:948
0.8297 4103488 9. Composer\Autoload\includeFile() project\vendor\composer\ClassLoader.php:322
0.8307 4164120 10. include('project\vendor\codedungeon\phpunit-result-printer\src\Printer.php') project\vendor\composer\ClassLoader.php:444
PHP Warning: Declaration of Codedungeon\PHPUnitPrettyResultPrinter\_ResultPrinter::writeProgressWithColor(string $progress, string $buffer): void should be compatible with PHPUnit\TextUI\ResultPrinter::writeProgressWithColor($color, $buffer): void in project\vendor\codedungeon\phpunit-result-printer\src\Printer.php on line 23
PHP Stack trace:
PHP 1. {main}() project\vendor\phpunit\phpunit\phpunit:0
PHP 2. PHPUnit\TextUI\Command::main() project\vendor\phpunit\phpunit\phpunit:53
PHP 3. PHPUnit\TextUI\Command->run() project\vendor\phpunit\phpunit\src\TextUI\Command.php:153
PHP 4. PHPUnit\TextUI\Command->handleArguments() project\vendor\phpunit\phpunit\src\TextUI\Command.php:169
PHP 5. PHPUnit\TextUI\Command->handlePrinter() project\vendor\phpunit\phpunit\src\TextUI\Command.php:861
PHP 6. class_exists() project\vendor\phpunit\phpunit\src\TextUI\Command.php:948
PHP 7. spl_autoload_call() project\vendor\phpunit\phpunit\src\TextUI\Command.php:948
PHP 8. Composer\Autoload\ClassLoader->loadClass() project\vendor\phpunit\phpunit\src\TextUI\Command.php:948
PHP 9. Composer\Autoload\includeFile() project\vendor\composer\ClassLoader.php:322
PHP 10. include() project\vendor\composer\ClassLoader.php:444
Warning: Declaration of Codedungeon\PHPUnitPrettyResultPrinter\_ResultPrinter::writeProgressWithColor(string $progress, string $buffer): void should be compatible with PHPUnit\TextUI\ResultPrinter::writeProgressWithColor($color, $buffer): void in project\vendor\codedungeon\phpunit-result-printer\src\Printer.php on line 23
Call Stack:
0.2457 353128 1. {main}() project\vendor\phpunit\phpunit\phpunit:0
0.3309 2189864 2. PHPUnit\TextUI\Command::main() project\vendor\phpunit\phpunit\phpunit:53
0.3309 2194424 3. PHPUnit\TextUI\Command->run() project\vendor\phpunit\phpunit\src\TextUI\Command.php:153
0.3309 2194424 4. PHPUnit\TextUI\Command->handleArguments() project\vendor\phpunit\phpunit\src\TextUI\Command.php:169
0.8292 4101208 5. PHPUnit\TextUI\Command->handlePrinter() project\vendor\phpunit\phpunit\src\TextUI\Command.php:861
0.8297 4103360 6. class_exists() project\vendor\phpunit\phpunit\src\TextUI\Command.php:948
0.8297 4103424 7. spl_autoload_call() project\vendor\phpunit\phpunit\src\TextUI\Command.php:948
0.8297 4103488 8. Composer\Autoload\ClassLoader->loadClass() project\vendor\phpunit\phpunit\src\TextUI\Command.php:948
0.8297 4103488 9. Composer\Autoload\includeFile() project\vendor\composer\ClassLoader.php:322
0.8307 4164120 10. include('project\vendor\codedungeon\phpunit-result-printer\src\Printer.php') project\vendor\composer\ClassLoader.php:444
Currently, the various test markers which are displayed are hard coded (sensible) values.
This feature will provide ability for developer to result markers using the phpunit-printer.yml
configuration file (where all other configuration occurs)
With version >= 0.7 the report writer will correctly display, however, it throws an error upon completion
Uncaught TypeError: Return value of Codedungeon\PHPUnitPrettyResultPrinter\Printer::writeProgress() must be an instance of Codedungeon\PHPUnitPrettyResultPrinter\void, none returned in /var/www/mfour_docker/vendor/codedungeon/phpunit-result-printer/src/Printer.php:129
Stack trace:
#0 /var/www/mfour_docker/vendor/phpunit/phpunit/src/TextUI/ResultPrinter.php(536): Codedungeon\PHPUnitPrettyResultPrinter\Printer->writeProgress('.')
#1 /var/www/mfour_docker/vendor/phpunit/phpunit/src/Framework/TestResult.php(399): PHPUnit_TextUI_ResultPrinter->endTest(Object(tests\Mfour\Unit\SanitizerTest), 0.025444030761719)
#2 /var/www/mfour_docker/vendor/phpunit/phpunit/src/Framework/TestResult.php(889): PHPUnit_Framework_TestResult->endTest(Object(tests\Mfour\Unit\SanitizerTest), 0.025444030761719)
#3 /var/www/mfour_docker/vendor/phpunit/phpunit/src/Framework/TestCase.php(868): PHPUnit_Framework_TestResult->run(Object(tests\Mfour\Unit\SanitizerTest))
#4 /var/www/mfour_docker/vendor/phpunit/phpunit/src/Framework/TestSuite.php(7 in /var/www/mfour_docker/vendor/codedungeon/phpunit-result-printer/src/Printer.php on line 129
root@a6cdc8c35ec5:/var/www/mfour_docker# ./vendor/bin/phpunit tests/Mfour/Unit
PHPUnit 5.7.27 by Sebastian Bergmann and contributors.
phpunit --printer=Codedungeon\\PHPUnitPrettyResultPrinter\\Printer
PHP Fatal error: Declaration of Codedungeon\PHPUnitPrettyResultPrinter\Printer::writeProgress($progress) must be compatible with PHPUnit\TextUI\ResultPrinter::writeProgress($progress): void in /home/xxx/vendor/codedungeon/phpunit-result-printer/src/Printer.php on line 36
Create testdox
reporter
This displays the default (yellow) R marker, still.
I don't mind making a PR for this, but I don't have much time to spare, so it would take a while before I get around to it.
I noticed that library isn't currently compatible with PHPUnit 7.1
Declaration of Codedungeon\PHPUnitPrettyResultPrinter\_ResultPrinter::writeProgress($progress): void should be compatible with PHPUnit\TextUI\ResultPrinter::writeProgress(string $progress): void
PHP Fatal error: Cannot declare class Codedungeon\PHPUnitPrettyResultPrinter\_ResultPrinter, because the name is already in use in /Users/vincentgabriel/Sites/xxx/vendor/codedungeon/phpunit-result-printer/src/Printer.php on line 21
Fatal error: Cannot declare class Codedungeon\PHPUnitPrettyResultPrinter\_ResultPrinter, because the name is already in use in /Users/vincentgabriel/Sites/xxx/vendor/codedungeon/phpunit-result-printer/src/Printer.php on line 21
Seems like codedungeon/phpunit-result-printer/src/Printer.php
checks which php unit version is installed
if i run
var_dump(class_exists('\PHPUnit_TextUI_ResultPrinter'), class_exists('\PHPUnit\TextUI\ResultPrinter'));
both return true, therefore the error above shown.
PHPUnit 6.2.2
PHP 7.1.6
Add circleci
support
Can we make this php 7.0 compatible? Or is 7.1 absolutely necessary?
Hi
It seems that the Printer.php file is not compatible with the _ResultsPrinter interface in PHP unit 7.
Two functions are affected, that being writeProgress
and writeProgressWithColor
.
writeProgress changes
From:
... protected function writeProgress($progress) ...
To:
... protected function writeProgress(string $progress): void ...
writeProgressWithColor changes
From:
... protected function writeProgressWithColor($color, $buffer) ...
To:
... protected function writeProgressWithColor($color, $buffer): void ...
Thanks
I tried to update the version of the package in my composer to the 0.20.3
and when I hit composer update
I got
Your requirements could not be resolved to an installable set of packages.
Problem 1
- Installation request for codedungeon/phpunit-result-printer ^0.20.3 -> satisfiable by codedungeon/phpunit-result-printer[0.20.3].
- codedungeon/phpunit-result-printer 0.20.3 requires php ^7.1 -> your PHP version (7.2.4) overridden by "config.platform.php" version (7.0) does not satisfy that requirement.
So it requires PHP > 7.1, which I have (7.2.4) but it still fails, and I'm not sure why tbh.
Hi there,
I'm using version 0.19.10 with PHPUnit 7.2.4 and get the following error:
PHP Fatal error: Class 'PHPUnit\Framework\BaseTestListener' not found in /var/www/phalcon/vendor/mockery/mockery/library/Mockery/Adapter/Phpunit/TestListener.php on line 29
PHP Stack trace:
PHP 1. {main}() /var/www/phalcon/vendor/phpunit/phpunit/phpunit:0
PHP 2. PHPUnit\TextUI\Command::main() /var/www/phalcon/vendor/phpunit/phpunit/phpunit:53
PHP 3. PHPUnit\TextUI\Command->run() /var/www/phalcon/vendor/phpunit/phpunit/src/TextUI/Command.php:156
PHP 4. PHPUnit\TextUI\TestRunner->doRun() /var/www/phalcon/vendor/phpunit/phpunit/src/TextUI/Command.php:203
PHP 5. PHPUnit\TextUI\TestRunner->handleConfiguration() /var/www/phalcon/vendor/phpunit/phpunit/src/TextUI/TestRunner.php:153
PHP 6. class_exists() /var/www/phalcon/vendor/phpunit/phpunit/src/TextUI/TestRunner.php:993
PHP 7. spl_autoload_call() /var/www/phalcon/vendor/phpunit/phpunit/src/TextUI/TestRunner.php:993
PHP 8. Composer\Autoload\ClassLoader->loadClass() /var/www/phalcon/vendor/phpunit/phpunit/src/TextUI/TestRunner.php:993
PHP 9. Composer\Autoload\includeFile() /var/www/phalcon/vendor/composer/ClassLoader.php:322
PHP 10. include() /var/www/phalcon/vendor/composer/ClassLoader.php:444
I am unable to use this package in laravel project. There seems to be some dependency constraint failure related to symphony/routing. Below is the output
You are running composer with xdebug enabled. This has a major impact on runtime performance. See https://getcomposer.org/xdebug
Using version ^0.3.0 for codedungeon/phpunit-result-printer
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.
Problem 1
- Conclusion: remove symfony/routing v3.4.2
- Conclusion: don't install symfony/routing v3.4.2
- symfony/yaml v3.3.0 conflicts with symfony/routing[v3.4.2].
- symfony/yaml v3.3.1 conflicts with symfony/routing[v3.4.2].
- symfony/yaml v3.3.10 conflicts with symfony/routing[v3.4.2].
- symfony/yaml v3.3.11 conflicts with symfony/routing[v3.4.2].
- symfony/yaml v3.3.12 conflicts with symfony/routing[v3.4.2].
- symfony/yaml v3.3.13 conflicts with symfony/routing[v3.4.2].
- symfony/yaml v3.3.14 conflicts with symfony/routing[v3.4.2].
- symfony/yaml v3.3.2 conflicts with symfony/routing[v3.4.2].
- symfony/yaml v3.3.3 conflicts with symfony/routing[v3.4.2].
- symfony/yaml v3.3.4 conflicts with symfony/routing[v3.4.2].
- symfony/yaml v3.3.5 conflicts with symfony/routing[v3.4.2].
- symfony/yaml v3.3.6 conflicts with symfony/routing[v3.4.2].
- symfony/yaml v3.3.7 conflicts with symfony/routing[v3.4.2].
- symfony/yaml v3.3.8 conflicts with symfony/routing[v3.4.2].
- symfony/yaml v3.3.9 conflicts with symfony/routing[v3.4.2].
- Installation request for symfony/routing (locked at v3.4.2) -> satisfiable by symfony/routing[v3.4.2].
- Installation request for codedungeon/phpunit-result-printer ^0.3.0 -> satisfiable by codedungeon/phpunit-result-printer[0.3.0].
- Conclusion: don't install symfony/yaml v4.0.2|install symfony/yaml v3.3.0|install symfony/yaml v3.3.1|install symfony/yaml v3.3.10|install symfony/yaml v3.3.11|install symfony/yaml v3.3.12|install symfony/yaml v3.3.13|install symfony/yaml v3.3.14|install symfony/yaml v3.3.2|install symfony/yaml v3.3.3|install symfony/yaml v3.3.4|install symfony/yaml v3.3.5|install symfony/yaml v3.3.6|install symfony/yaml v3.3.7|install symfony/yaml v3.3.8|install symfony/yaml v3.3.9
- Conclusion: remove symfony/yaml v4.0.2|install symfony/yaml v3.3.0|install symfony/yaml v3.3.1|install symfony/yaml v3.3.10|install symfony/yaml v3.3.11|install symfony/yaml v3.3.12|install symfony/yaml v3.3.13|install symfony/yaml v3.3.14|install symfony/yaml v3.3.2|install symfony/yaml v3.3.3|install symfony/yaml v3.3.4|install symfony/yaml v3.3.5|install symfony/yaml v3.3.6|install symfony/yaml v3.3.7|install symfony/yaml v3.3.8|install symfony/yaml v3.3.9
- codedungeon/phpunit-result-printer 0.3.0 requires symfony/yaml ^3.3 -> satisfiable by symfony/yaml[v3.3.0, v3.3.1, v3.3.10, v3.3.11, v3.3.12, v3.3.13, v3.3.14, v3.3.2, v3.3.3, v3.3.4, v3.3.5, v3.3.6, v3.3.7, v3.3.8, v3.3.9, v3.4.0, v3.4.1, v3.4.2].
- Can only install one of: symfony/yaml[v3.4.0, v4.0.2].
- Can only install one of: symfony/yaml[v3.4.1, v4.0.2].
- Can only install one of: symfony/yaml[v3.4.2, v4.0.2].
- Installation request for symfony/yaml (locked at v4.0.2) -> satisfiable by symfony/yaml[v4.0.2].
Installation failed, reverting ./composer.json to its original content.
PHP Version - 7.1.4
PHPUnit Version - 6.0
I got error in my terminal:
[Composer\Downloader\TransportException]
The "http://packagist.org/p/provider-2018-01%24bf6dfbd24258ae775d775a25568400d088a62534c6c3de33fba60da6776dacf1.json" file could not be downloaded (HT
TP/1.1 302 Found)
I'm using:
Output is:
PHPUnit 6.5.7 by Sebastian Bergmann and contributors.
PHP Fatal error: Uncaught TypeError: Return value of Codedungeon\PHPUnitPrettyResultPrinter\_ResultPrinter::startTest() must be an instance of Codedungeon\PHPUnitPrettyResultPrinter\void, none returned in /Users/ra/Developer/l55/vendor/codedungeon/phpunit-result-printer/src/Printer.php:27
Stack trace:
#0 /Users/ra/Developer/l55/vendor/phpunit/phpunit/src/Framework/TestResult.php(395): Codedungeon\PHPUnitPrettyResultPrinter\_ResultPrinter->startTest(Object(Tests\Routes\UITest))
#1 /Users/ra/Developer/l55/vendor/phpunit/phpunit/src/Framework/TestResult.php(637): PHPUnit\Framework\TestResult->startTest(Object(Tests\Routes\UITest))
#2 /Users/ra/Developer/l55/vendor/phpunit/phpunit/src/Framework/TestCase.php(894): PHPUnit\Framework\TestResult->run(Object(Tests\Routes\UITest))
#3 /Users/ra/Developer/l55/vendor/phpunit/phpunit/src/Framework/TestSuite.php(755): PHPUnit\Framework\TestCase->run(Object(PHPUnit\Framework\TestResult))
#4 /Users/ra/Developer/l55/vendor/phpunit/phpunit/src/Tex in /Users/ra/Developer/l55/vendor/codedungeon/phpunit-result-printer/src/Printer.php on line 27
Fatal error: Uncaught TypeError: Return value of Codedungeon\PHPUnitPrettyResultPrinter\_ResultPrinter::startTest() must be an instance of Codedungeon\PHPUnitPrettyResultPrinter\void, none returned in /Users/ra/Developer/l55/vendor/codedungeon/phpunit-result-printer/src/Printer.php:27
Stack trace:
#0 /Users/ra/Developer/l55/vendor/phpunit/phpunit/src/Framework/TestResult.php(395): Codedungeon\PHPUnitPrettyResultPrinter\_ResultPrinter->startTest(Object(Tests\Routes\UITest))
#1 /Users/ra/Developer/l55/vendor/phpunit/phpunit/src/Framework/TestResult.php(637): PHPUnit\Framework\TestResult->startTest(Object(Tests\Routes\UITest))
#2 /Users/ra/Developer/l55/vendor/phpunit/phpunit/src/Framework/TestCase.php(894): PHPUnit\Framework\TestResult->run(Object(Tests\Routes\UITest))
#3 /Users/ra/Developer/l55/vendor/phpunit/phpunit/src/Framework/TestSuite.php(755): PHPUnit\Framework\TestCase->run(Object(PHPUnit\Framework\TestResult))
#4 /Users/ra/Developer/l55/vendor/phpunit/phpunit/src/Tex in /Users/ra/Developer/l55/vendor/codedungeon/phpunit-result-printer/src/Printer.php on line 27
phpunit ~7.0 enforces return type:
public function startTest(Test $test): void
So the printer fails. I can do a PR but I don't think that should be merged into the master branch. Any advice?
I was wondering if Teamcity support is a thing you're considering? PhpStorm / Intellij automatically uses that format and I haven't found a way to disable it.
Would gladly put some work into making a PR myself, but I have no clue how phpunit printers work
phpunit-pretty-result-printer/src/Printer.php
Line 301 in 30bd2d7
The : int
appears to be causing the following error message in PHPUnit 5.7.26:
PHP Parse error: syntax error, unexpected ':', expecting ';' or '{' in /vendor/codedungeon/phpunit-result-printer/src/Printer.php on line 302
When I remove that text, the package works correctly.
Is it meant to be there for different versions, or is it a typo?
We have a test class that currently has no tests in it (it's a placeholder until we get time to write the tests).
In this instance, output looks like this....
==> AbstractDriverTest ✓ ✓ ✓ ✓ ✓ ✓
==> ConfigTest ✓
==> PHPUnit_Framework_WarningTestCase W
==> ShortlistControllerTest ✓ ✓ ✓
That PHPUnit_Framework_WarningTestCase
line should actually refer to the empty test class which in my case is called SavedSearchControllerTest
.
Not a big deal, but thought i'd mention it incase you weren't aware.
Thanks
The composer states:
"php": "^7.0",
while the code contains:
public function startTest(\PHPUnit\Framework\Test $test): void
will result in:
PHPUnit 6.5.7 by Sebastian Bergmann and contributors.
Fatal error: Uncaught TypeError: Return value of Codedungeon\PHPUnitPrettyResultPrinter\_ResultPrinter::startTest() must be an instance of Codedungeon\PHPUnitPrettyResultPrinter\void, none returned in vendor/codedungeon/phpunit-result-printer/src/Printer.php on line 27
TypeError: Return value of Codedungeon\PHPUnitPrettyResultPrinter\_ResultPrinter::startTest() must be an instance of Codedungeon\PHPUnitPrettyResultPrinter\void, none returned in vendor/codedungeon/phpunit-result-printer/src/Printer.php on line 27
:void
return types only work in php 7.2+ and therefor it will break when using < 7.2
Warning: Declaration of Codedungeon\PHPUnitPrettyResultPrinter\_ResultPrinter::writeProgressWithColor($progress, $buffer): void should be compatible with PHPUnit\TextUI\ResultPrinter::writeProgressWithColor(string $color, string $buffer): void in /builds/bogdan/prokect/vendor/codedungeon/phpunit-result-printer/src/Printer.php on line 24
php 7.1.16
phpunit 7.1.1
works well on phpunit 7.0.3
PHP version requirement should be set to 7.1, as certain features specific for that version are used in some places. For example, void
return type is used here: https://github.com/mikeerickson/phpunit-pretty-result-printer/blob/master/src/Printer.php#L160.
PHP Fatal error: Declaration of Codedungeon\PHPUnitPrettyResultPrinter\Printer::writeProgress($progress) must be compatible with PHPUnit\TextUI\ResultPrinter::writeProgress($progress): void in /home/vagrant/mailsoft/vendor/codedungeon/phpunit-result-printer/src/Printer.php on line 36
Hi,
I tried to use the Printer on windows with phpunit 6.5.5 in a Laravel Project.
When I add it to phpunit.xml and run the tests they appear to run forever with no output.
When I set the printer in commandline I get the following error:
$ phpunit --printer=Codedungeon\\PHPUnitPrettyResultPrinter\\Printer
PHPUnit 6.5.5 by Sebastian Bergmann and contributors.
Could not use "Codedungeon\\PHPUnitPrettyResultPrinter\\Printer" as printer: class does not exist
Is this a Windows related issue or am a doing something wrong?
Thanks
At first thanks a lot for your library that me get a really fast overview about my tests. I use it since linger times.
Currently I have problems in a project, that use the library. Aftercomposer update
the version 0.20.1 is active and I get always the error message
PHP Fatal error: Uncaught Noodlehaus\Exception\FileNotFoundException: Configuration file: [/home/travis/build/bueltge/marksimple/vendor/codedungeon/phpunit-result-printer/phpunit-printer.yml] cannot be found in /home/travis/build/bueltge/marksimple/vendor/hassankhan/config/src/Config.php:173
Stack trace:
#0 /home/travis/build/bueltge/marksimple/vendor/hassankhan/config/src/Config.php(54): Noodlehaus\Config->getValidPath('/home/travis/bu...')
#1 /home/travis/build/bueltge/marksimple/vendor/codedungeon/phpunit-result-printer/src/PrinterTrait.php(76): Noodlehaus\Config->__construct('/home/travis/bu...')
#2 /home/travis/build/bueltge/marksimple/vendor/phpunit/phpunit/src/TextUI/TestRunner.php(287): Codedungeon\PHPUnitPrettyResultPrinter\Printer->__construct(NULL, false, 'auto', false, 80, false)
#3 /home/travis/build/bueltge/marksimple/vendor/phpunit/phpunit/src/TextUI/Command.php(212): PHPUnit\TextUI\TestRunner->doRun(Object(PHPUnit\Framework\TestSuite), Array, true)
#4 /home/travis/build/bueltge/marksimple/vendor/phpunit/phpuni in /home/travis/build/bueltge/marksimple/vendor/hassankhan/config/src/Config.php on line 173
Fatal error: Uncaught Noodlehaus\Exception\FileNotFoundException: Configuration file: [/home/travis/build/bueltge/marksimple/vendor/codedungeon/phpunit-result-printer/phpunit-printer.yml] cannot be found in /home/travis/build/bueltge/marksimple/vendor/hassankhan/config/src/Config.php on line 173
Noodlehaus\Exception\FileNotFoundException: Configuration file: [/home/travis/build/bueltge/marksimple/vendor/codedungeon/phpunit-result-printer/phpunit-printer.yml] cannot be found in /home/travis/build/bueltge/marksimple/vendor/hassankhan/config/src/Config.php on line 173
Maybe you have a hint for me, always the init. php and the json file is missed.
The problem is still existent on local client and also on travis. That's my composer.json for the dependencies:
"require-dev": {
"phpunit/phpunit": "6.3.*",
"codedungeon/phpunit-result-printer": "^0.20",
"inpsyde/php-coding-standards": "^0.13",
"antecedent/patchwork": "^2.1",
"dg/composer-cleaner": "^2"
},
When outputting tests which are long, they are wrapping at 80 chars, adjust this so it gets the available colwidth to perform wrapping
Currently, the method for loading configuration data is only pulled from the final found file.
This has led to an issue whereby if users has a phpunit-printer.yml
file somewhere in the checked paths, it will override default
settings which are located in the <project>/phpunit-printer.yml
file which all sensible defaults are found.
Include failed (F) and pass symbols (.) as strings when simple output is set instead of icons
PR - #47
As of tag 0.8.4
the Printer is declaring void
as return type for certain methods.
However, void
is only available to PHP7.1 and up.
Your composer.json
specifies:
"require": {
"php": "^7.0"
}
This serves incompatible code to PHP7.0 environments.
The PHP requirement in composer.json
should be updated to reflect the new dependency on PHP7.1, in order to prevent people running PHP7.0 from downloading this version.
"require": {
"php": "^7.1"
}
Fix reported StyleCI issues -- https://styleci.io/analyses/zEmdKm
The package limits PHP to version ^7.0 but Travis has a 5.6 case
PR - #48
I just installed the extension and put
<phpunit printerClass="Codedungeon\PHPUnitPrettyResultPrinter\Printer">
in my phpunit.xml
When trying to run phpunit the terminal just hangs. I can stop the script with ctrl+c, so it doesn't freeze the terminal. The problem is, nothing happens.
I am using Windows 10. Tried with the command prompt, Windows Powershell and GitBash.
Nvm, just had to update my version of the package.
On Windows I keep getting the "The system cannot find the path specified." error when running phpunit with the php-pretty-result-printer installed.
Tests run fine but error message is annoying.
Version information:
Windows 10 (x64) - 1709
phpunit-pretty-result-printer v0.10.1
PHP 7.2.2
PHPUnit 7.0.1
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.