Build/Test Tools: Only perform an assertion for deprecated calls and wrongdoings if any are expected.

This avoids masking risky tests that don't otherwise perform an assertion.

See #40538


git-svn-id: https://develop.svn.wordpress.org/trunk@40541 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
John Blackbourn 2017-04-23 21:28:44 +00:00
parent 1eb45efa86
commit 21ce4e90d3

View File

@ -388,7 +388,10 @@ class WP_UnitTestCase extends PHPUnit_Framework_TestCase {
$errors[] = "Unexpected incorrect usage notice for $unexpected";
}
$this->assertEmpty( $errors, implode( "\n", $errors ) );
// Perform an assertion, but only if there are expected deprecated calls or expected wrongdoings
if ( ! empty( $this->expected_deprecated ) || ! empty( $this->expected_doing_it_wrong ) ) {
$this->assertEmpty( $errors, implode( "\n", $errors ) );
}
}
/**