Tests: Clean up skipping conditions and requirements for various tests.

This improves the consistency of test skipping and ensures that:

* The `@requires` annotations use the right condition and format, and are on the right level (class vs. function).
* Inline conditions with a `markTestSkipped()` call are only used when annotations cannot be used.
* All `markTestSkipped()` calls contain a verbose explanation of why the test is being skipped.

Props jrf, hellofromTonya.
Fixes #53009.

git-svn-id: https://develop.svn.wordpress.org/trunk@51415 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Sergey Biryukov
2021-07-13 10:43:42 +00:00
parent 4d616c6665
commit b396844d38
29 changed files with 183 additions and 125 deletions

View File

@@ -242,12 +242,10 @@ EOT;
* Test is_countable() polyfill for ResourceBundle.
*
* @ticket 43583
*
* @requires extension intl
*/
function test_is_countable_ResourceBundle() {
if ( ! class_exists( 'ResourceBundle' ) ) {
$this->markTestSkipped( 'The intl extension is not loaded. ResourceBundle not tested for is_countable().' );
}
$this->assertTrue( is_countable( new ResourceBundle( 'en', null ) ) );
}
@@ -255,12 +253,10 @@ EOT;
* Test is_countable() polyfill for SimpleXMLElement.
*
* @ticket 43583
*
* @requires extension simplexml
*/
function test_is_countable_SimpleXMLElement() {
if ( ! class_exists( 'SimpleXMLElement' ) ) {
$this->markTestSkipped( 'The xml extension is not loaded. SimpleXMLElement not tested for is_countable().' );
}
$this->assertTrue( is_countable( new SimpleXMLElement( '<xml><tag>1</tag><tag>2</tag></xml>' ) ) );
}