Permalink
Browse files

Merge branch '8.0'

  • Loading branch information...
sebastianbergmann committed Feb 8, 2019
2 parents 5801375 + 96dd7db commit 652bdd9e92f228cf8358d0817deb08aa124965fe
@@ -7,6 +7,7 @@ All notable changes of the PHPUnit 7.5 release series are documented in this fil
### Fixed

* Fixed [#3515](https://github.com/sebastianbergmann/phpunit/issues/3515): Random order seed is only printed in verbose mode
* Fixed [#3517](https://github.com/sebastianbergmann/phpunit/issues/3517): Useless error message when depending on test that does not exist

## [7.5.4] - 2019-02-07

@@ -7,6 +7,7 @@ All notable changes of the PHPUnit 8.0 release series are documented in this fil
### Fixed

* Fixed [#3515](https://github.com/sebastianbergmann/phpunit/issues/3515): Random order seed is only printed in verbose mode
* Fixed [#3517](https://github.com/sebastianbergmann/phpunit/issues/3517): Useless error message when depending on test that does not exist

## [8.0.2] - 2019-02-07

@@ -1772,22 +1772,11 @@ private function handleDependencies(): bool
}
if (!isset($passedKeys[$dependency])) {
$this->status = BaseTestRunner::STATUS_SKIPPED;
$this->result->startTest($this);
$this->result->addError(
$this,
new SkippedTestError(
\sprintf(
'This test depends on "%s" to pass.',
$dependency
)
),
0
);
$this->result->endTest($this, 0);
if (!\is_callable($dependency, false, $callableName) || $dependency !== $callableName) {
$this->markWarningForUncallableDependency($dependency);
} else {
$this->markSkippedForMissingDependecy($dependency);
}
return false;
}
@@ -1826,6 +1815,40 @@ private function handleDependencies(): bool
return true;
}
private function markSkippedForMissingDependecy(string $dependency): void
{
$this->status = BaseTestRunner::STATUS_SKIPPED;
$this->result->startTest($this);
$this->result->addError(
$this,
new SkippedTestError(
\sprintf(
'This test depends on "%s" to pass.',
$dependency
)
),
0
);
$this->result->endTest($this, 0);
}
private function markWarningForUncallableDependency(string $dependency): void
{
$this->status = BaseTestRunner::STATUS_WARNING;
$this->result->startTest($this);
$this->result->addWarning(
$this,
new Warning(
\sprintf(
'This test depends on "%s" which does not exist.',
$dependency
)
),
0
);
$this->result->endTest($this, 0);
}
/**
* Get the mock object generator, creating it if it doesn't exist.
*/
@@ -39,4 +39,17 @@ public function testFour(): void
{
$this->assertTrue(true);
}
/**
* This test has been added to check the printed warnings for the user
* when a dependency simply doesn't exist.
*
* @depends doesNotExist
*
* @see https://github.com/sebastianbergmann/phpunit/issues/3517
*/
public function testHandlesDependsAnnotationForNonexistentTests(): void
{
$this->assertTrue(true);
}
}
@@ -18,10 +18,17 @@ PHPUnit %s by Sebastian Bergmann and contributors.
Runtime: %s
...FSSS 7 / 7 (100%)
...FSSSW 8 / 8 (100%)
Time: %s, Memory: %s
There was 1 warning:
1) DependencyFailureTest::testHandlesDependsAnnotationForNonexistentTests
This test depends on "DependencyFailureTest::doesNotExist" which does not exist.
--
There was 1 failure:
1) DependencyFailureTest::testOne
@@ -42,4 +49,4 @@ This test depends on "DependencyFailureTest::testTwo" to pass.
This test depends on "DependencyFailureTest::testOne" to pass.
FAILURES!
Tests: 7, Assertions: 4, Failures: 1, Skipped: 3.
Tests: 8, Assertions: 4, Failures: 1, Warnings: 1, Skipped: 3.

0 comments on commit 652bdd9

Please sign in to comment.