Skip to content

Commit

Permalink
Tests/UtilityMethodTestCase::skipJSCSSTestsOnPHPCS4: get rid of "risk…
Browse files Browse the repository at this point in the history
…y test" warning

When the `@doesNotPerformAssertions` annotation is used, the test shows as risky when run in combination with PHPCS 4.x as it does perform assertions (expects an exception), but removing the annotation would make the test as risky when run in combination with PHPCS 3.x as in that case, it didn't perform an assertion.

While a little hackish, this small tweak gets rid of the warnings in all circumstances.
  • Loading branch information
jrfnl committed Dec 22, 2020
1 parent 58bb724 commit 17feba0
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions Tests/TestUtils/UtilityMethodTestCase/SkipCSJSTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,6 @@ public function skipJSCSSTestsOnPHPCS4()
/**
* Test that the skipJSCSSTestsOnPHPCS4() skips JS/CSS file tests on PHPCS 4.x.
*
* @doesNotPerformAssertions
*
* @return void
*/
public function testSkipJsCss()
Expand All @@ -68,6 +66,9 @@ public function testSkipJsCss()
// PHPUnit 4.
$this->setExpectedException($exception, $msg);
}
} else {
// Get rid of the "does not perform assertions" warning when run with PHPCS 3.x.
$this->assertTrue( true );
}

parent::skipJSCSSTestsOnPHPCS4();
Expand Down

0 comments on commit 17feba0

Please sign in to comment.