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
-------
ba5c0f4a47
Count @expectedDeprecation as an assertion
This commit is contained in:
commit
cc5c233f15
@ -186,6 +186,10 @@ class SymfonyTestsListener extends \PHPUnit_Framework_BaseTestListener
|
||||
public function endTest(\PHPUnit_Framework_Test $test, $time)
|
||||
{
|
||||
if ($this->expectedDeprecations) {
|
||||
if (!in_array($test->getStatus(), array(\PHPUnit_Runner_BaseTestRunner::STATUS_SKIPPED, \PHPUnit_Runner_BaseTestRunner::STATUS_INCOMPLETE), true)) {
|
||||
$test->addToAssertionCount(count($this->expectedDeprecations));
|
||||
}
|
||||
|
||||
restore_error_handler();
|
||||
|
||||
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)) {
|
||||
|
Reference in New Issue
Block a user