Coder Social home page Coder Social logo

mikeerickson / phpunit-pretty-result-printer Goto Github PK

View Code? Open in Web Editor NEW
1.2K 20.0 71.0 709 KB

PHPUnit Pretty Result Printer -- make your PHPUnit tests look pretty!

License: MIT License

PHP 95.39% JavaScript 4.08% Shell 0.53%
hacktoberfest hacktoberfest2020

phpunit-pretty-result-printer's Issues

Timeout when running test that generates coverage

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.

Misaligned status marks

When running a test with both passing and failing tests the marks are mis-aligned. See my example

Ambiguous class resolution

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.

PHPUnit 7.0 Error

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

When the first test in a file fails, it is shown as a failure on the previous line

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                              ✓ 

Fresh installation gives bunch of warnings

HI @mikeerickson

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

Add support for custom test markers

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)

Report writing appeasrs correctly, but then throws an error

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.

Check mark outlining bug

print bug
Hi, I get this outlining. I didn't change any of the default configuration. This is a docker container, running Ubuntu 16.04. I didn't see anything similar in the other issues, so I thought I'd bring this to your attention. If it's a duplicate, you can just remove this.

Declaration not compatible with phpunit 7.0

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

Library not compatible with PHPUnit 7.1.1

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

Fatal Error

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

php 7.0

Can we make this php 7.0 compatible? Or is 7.1 absolutely necessary?

Compatibility with PHP Unit 7 ResultsPrinter interface

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

Not working on php 7.2?

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.

PHP Fatal error

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

Unable to add this package.

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

How do I fix the "Return value must be an instance of Codedungeon\PHPUnitPrettyResultPrinter\void" ?

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

Not working with phpunit ~7.0

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?

Teamcity support?

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

PHP Parse error: syntax error, unexpected ':', expecting ';' or '{' in src/Printer.php on line 302

private function getWidth() : int

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?

Empty test class shows incorrect class name

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

php 7.0 compatibility broken

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

Noticed this warning when running on phpunit 7.1.1

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

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

Could not use "Codedungeon\\PHPUnitPrettyResultPrinter\\Printer" as printer: class does not exist

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

Missing files

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"
    },

Merge all settings files when loading config

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.

Return type void incompatible with php 7.0

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"
}

Terminal is hanging when starting phpunit on Windows

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.

Error on Windows: The system cannot find the path specified

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.