Skip to content

Make result printer compatible with phpUnit version 7 #18

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

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ sudo: false
dist: trusty

php:
- 7.0
- 7.1
- 7.2
- nightly

before_script:
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"whatthejeff/nyancat-scoreboard": "~1.1"
},
"require-dev": {
"phpunit/phpunit": "^6.5"
"phpunit/phpunit": "^7.0"
},
"autoload": {
"psr-4": {
Expand Down
1 change: 0 additions & 1 deletion phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
printerClass="NyanCat\PHPUnit\ResultPrinter"
processIsolation="false"
stopOnFailure="false"
syntaxCheck="false"
bootstrap="vendor/autoload.php"
>
<testsuites>
Expand Down
37 changes: 22 additions & 15 deletions src/NyanCat/PHPUnit/ResultPrinter.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,11 @@ public function __construct($out = NULL, $verbose = FALSE, $colors = self::COLOR
/**
* {@inheritdoc}
*/
protected function writeProgress($progress)
protected function writeProgress(string $progress): void
{
if($this->debug) {
return parent::writeProgress($progress);
parent::writeProgress($progress);
return ;
}

$this->scoreboard->score($progress);
Expand All @@ -80,7 +81,7 @@ protected function writeProgress($progress)
/**
* {@inheritdoc}
*/
protected function printHeader()
protected function printHeader(): void
{
if (!$this->debug) {
if (!$this->scoreboard->isRunning()) {
Expand All @@ -95,10 +96,11 @@ protected function printHeader()
/**
* {@inheritdoc}
*/
public function addError(Test $test, \Exception $e, $time)
public function addError(Test $test, \Throwable $e, float $time): void
{
if ($this->debug) {
return parent::addError($test, $e, $time);
parent::addError($test, $e, $time);
return ;
}

$this->writeProgress('fail');
Expand All @@ -108,10 +110,11 @@ public function addError(Test $test, \Exception $e, $time)
/**
* {@inheritdoc}
*/
public function addFailure(Test $test, AssertionFailedError $e, $time)
public function addFailure(Test $test, AssertionFailedError $e, float $time): void
{
if ($this->debug) {
return parent::addFailure($test, $e, $time);
parent::addFailure($test, $e, $time);
return ;
}

$this->writeProgress('fail');
Expand All @@ -121,10 +124,11 @@ public function addFailure(Test $test, AssertionFailedError $e, $time)
/**
* {@inheritdoc}
*/
public function addIncompleteTest(Test $test, \Exception $e, $time)
public function addIncompleteTest(Test $test, \Throwable $e, float $time): void
{
if ($this->debug) {
return parent::addIncompleteTest($test, $e, $time);
parent::addIncompleteTest($test, $e, $time);
return ;
}

$this->writeProgress('pending');
Expand All @@ -134,10 +138,11 @@ public function addIncompleteTest(Test $test, \Exception $e, $time)
/**
* {@inheritdoc}
*/
public function addSkippedTest(Test $test, \Exception $e, $time)
public function addSkippedTest(Test $test, \Throwable $e, float $time): void
{
if ($this->debug) {
return parent::addSkippedTest($test, $e, $time);
parent::addSkippedTest($test, $e, $time);
return ;
}

$this->writeProgress('pending');
Expand All @@ -147,10 +152,11 @@ public function addSkippedTest(Test $test, \Exception $e, $time)
/**
* {@inheritdoc}
*/
public function startTestSuite(TestSuite $suite)
public function startTestSuite(TestSuite $suite): void
{
if ($this->debug) {
return parent::startTestSuite($suite);
parent::startTestSuite($suite);
return ;
}

if ($this->numTests == -1) {
Expand All @@ -162,10 +168,11 @@ public function startTestSuite(TestSuite $suite)
/**
* {@inheritdoc}
*/
public function endTest(Test $test, $time)
public function endTest(Test $test, float $time): void
{
if ($this->debug) {
return parent::endTest($test, $time);
parent::endTest($test, $time);
return ;
}

if (!$this->lastTestFailed) {
Expand Down
3 changes: 1 addition & 2 deletions tests/NyanCat/PHPUnit/Tests/_files/phpunit.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@
printerClass="NyanCat\PHPUnit\ResultPrinter"
processIsolation="false"
stopOnFailure="false"
syntaxCheck="false"
bootstrap="../../../../../vendor/autoload.php"
>

</phpunit>
</phpunit>