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
-5
View File
@@ -20,11 +20,6 @@ abstract class WP_HTTP_UnitTestCase extends WP_UnitTestCase {
function setUp() {
parent::setUp();
if ( is_callable( array( 'WP_Http', '_getTransport' ) ) ) {
$this->markTestSkipped( 'The WP_Http tests require a class-http.php file of r17550 or later.' );
return;
}
$class = 'WP_Http_' . ucfirst( $this->transport );
if ( ! call_user_func( array( $class, 'test' ) ) ) {
$this->markTestSkipped( sprintf( 'The transport %s is not supported on this system.', $this->transport ) );
-1
View File
@@ -3,7 +3,6 @@
/**
* @group http
* @group external-http
* @requires extension openssl
*/
class Tests_HTTP_Functions extends WP_UnitTestCase {