limedeck / phpunit-detailed-printer Goto Github PK
View Code? Open in Web Editor NEWDetailed output formatter for PHPUnit tests
License: MIT License
Detailed output formatter for PHPUnit tests
License: MIT License
The same exact config with 5.7.21 works fine but with 6.3 returns:
PHPUnit 6.3.0 by Sebastian Bergmann and contributors.
Could not use "LimeDeck\Testing\Printer" as printer.
For what I see they removed the long class names and everything is now namespaced but I don't know if this has anything to do with this problem. Phpunit is not giving any details...
In version 3 name for test with data provider looks like the following:
(6/7) ✔ PrinterNamesTest: It Supports Data Provider with data set #0 ('a', 'b', 'bc') (%s ms)
But in version 4 there is no test data:
(6/7) ✔ PrinterNamesTest: It Supports Data Provider with data set #0 (0 ms)
I added tests for v3 branch [code] [travis]. And they are pass.
The same tests in v4 are fail [travis]
The reason for this behavior is split of the describe
method in \PHPUnit\Util\Test
commit
PHP 7.1.17
PHPUnit ^6.0 and ~7.0
I really like this test printer but the only issue I have so far is that as soon as a test fails the whole suite aborts. This behaviour seems to happen only with this printer.
Is this intentional or is it a bug?
I am using this printer in windows console and the results prints as expected. I really wanted this. But the result adds an extra )
with every testrow printed.
I solved it by adding \r
to the writeProgress
function where $this->write()
is called.
protected function writeProgress($progress)
{
if ($this->hasReplacementSymbol($progress)) {
$progress = static::$symbols[$progress];
}
$this->write("{$progress} {$this->testRow}\r");
$this->column++;
$this->numTestsRun++;
}
Can you update the code in this repo? @insanesvk @hrcc
Currently PHPUnit 7 is not supported. This seems to be because of the method signature change(s) in classes and interfaces between PHPUnit 5.6 and PHPUnit 7.
Hi, I wanted to add this to a laravel project, but when I ran my tests it prompts an error
Fatal error: Class 'PHPUnit\TextUI\ResultPrinter' not found in laravel-project\vendor\limedeck\phpunit-detailed-printer\src\Printer.php on line 12
We came across this issue because the our library runs unit tests in the CI pipeline on php 7.1
up to php 8.0
. When defining the requirement phpunit/phpunit
with *
it installs what ever is compatible to the current tested php version. But limedeck/phpunit-detailed-printer *
always installs version 6.
In fact phpunit is not just a requirement for developement but also for production. In order to solve that every major version needs an update with the requirement of phpunit version.
If you want I can prepare some merge requests.
It would be awesome if test results could be displayed more like a sentence. For example:
✓ Door can be opened and closed
✓ Door has a handle on each side
✓ Door cannot be opened if locked
✓ Window can be opened and closed
✓ Window has a handle on each side
✓ Window cannot be opened if locked
✓ Window smashes if struck
or
Door
✓ can be opened and closed
✓ has a handle on each side
✓ cannot be opened if locked
Window
✓ can be opened and closed
✓ is transparent
✓ cannot be opened if locked
✓ smashes if struck
I appreciate this may not suit everyone, so maybe it could be enabled or disabled by a flag or something. Jest by facebook produces test results in the latter format, and it makes them very nice to read like a spec.
You can see an example of this here
Currently, it shows the fully qualified class name, which can be a little verbose at times. Maybe this could only happen if someone turns debug
or verbose
on?
PHP Fatal error: Declaration of LimeDeck\Testing\Printer::addError(PHPUnit\Framework\Test $test, Exception $e, $time) must be compatible with PHPUnit\TextUI\ResultPrinter::addError(PHPUnit\Framework\Test $test, Throwable $t, float $time): void in vendor/limedeck/phpunit-detailed-printer/src/Printer.php on line 226
Fatal error: Declaration of LimeDeck\Testing\Printer::addError(PHPUnit\Framework\Test $test, Exception $e, $time) must be compatible with PHPUnit\TextUI\ResultPrinter::addError(PHPUnit\Framework\Test $test, Throwable $t, float $time): void in vendor/limedeck/phpunit-detailed-printer/src/Printer.php on line 226
Hi there,
I'm using this dependency and was wondering if there are plans for PHPUnit 9 support?
It looks like in PHPUnit 9 the PHPUnit\TextUI\ResultPrinter
class has been converted into an interface
(check sebastianbergmann/phpunit#4024) and there is now a PHPUnit\TextUI\DefaultResultPrinter
So the fix to the issue would be simply to change this part:
phpunit-detailed-printer/src/Printer.php
Lines 3 to 11 in ae5ab59
to this:
namespace LimeDeck\Testing;
use PHPUnit\Framework\Test;
use PHPUnit\Framework\Warning;
use PHPUnit\TextUI\DefaultResultPrinter;
use PHPUnit\Util\Test as UtilTest;
use PHPUnit\Framework\AssertionFailedError;
class Printer extends DefaultResultPrinter
{
...
}
Tests that fail because of an error in the test will not show the test name.
If the test follows another one it will show the name from the previous test.
✔ Tests\Integration\Jobs\PrepareVRDownloadTest: Could not get signature for device id (713 ms)
! Tests\Integration\Jobs\PrepareVRDownloadTest: Could not get signature for device id (713 ms)
✔ Tests\Integration\Jobs\PrepareVRDownloadTest: Copied signature for device id (765 ms)
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.