8000 bug #21896 [PHPunitBridge] Count @expectedDeprecation as an assertion… · symfony/symfony@cc5c233 · GitHub
[go: up one dir, main page]

Skip to content

Commit cc5c233

Browse files
committed
bug #21896 [PHPunitBridge] Count @expectedDeprecation as an assertion (wouterj)
This PR was merged into the 3.2 branch. Discussion ---------- [PHPunitBridge] Count @expectedDeprecation as an assertion | Q | A | ------------- | --- | Branch? | 3.2 | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | - | License | MIT | Doc PR | - By adding `addToAssertionCount()`, the `@expectedDeprecation` annotation is recognized as an assertion by PHPUnit. This means PHPUnit will not report the test as risky because it does not contain any assertion. Commits ------- ba5c0f4 Count @expectedDeprecation as an assertion
2 parents 4d91022 + ba5c0f4 commit cc5c233

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/Symfony/Bridge/PhpUnit/SymfonyTestsListener.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,10 @@ public function startTest(\PHPUnit_Framework_Test $test)
186186
public function endTest(\PHPUnit_Framework_Test $test, $time)
187187
{
188188
if ($this->expectedDeprecations) {
189+
if (!in_array($test->getStatus(), array(\PHPUnit_Runner_BaseTestRunner::STATUS_SKIPPED, \PHPUnit_Runner_BaseTestRunner::STATUS_INCOMPLETE), true)) {
190+
$test->addToAssertionCount(count($this->expectedDeprecations));
191+
}
192+
189193
restore_error_handler();
190194

191195
if (!in_array($test->getStatus(), array(\PHPUnit_Runner_BaseTestRunner::STATUS_SKIPPED, \PHPUnit_Runner_BaseTestRunner::STATUS_INCOMPLETE, \PHPUnit_Runner_BaseTestRunner::STATUS_FAILURE, \PHPUnit_Runner_BaseTestRunner::STATUS_ERROR), true)) {

0 commit comments

Comments
 (0)
0