mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-03-25 15:54:26 +00:00
Build/Test Tools: Automatically skip tests in the ms-required and ms-excluded groups.
This removes the need to manually call `$this->skipWithMultisite()` and `$this->skipWithoutMultisite()` from within the test when the test only runs without Multisite or only runs on Multisite, respectively. Props jdgrimes for the suggestion. Fixes #40531 git-svn-id: https://develop.svn.wordpress.org/trunk@40564 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -577,6 +577,17 @@ class WP_UnitTestCase extends PHPUnit_Framework_TestCase {
|
||||
protected function checkRequirements() {
|
||||
parent::checkRequirements();
|
||||
|
||||
$annotations = $this->getAnnotations();
|
||||
|
||||
if ( ! empty( $annotations['group'] ) ) {
|
||||
if ( in_array( 'ms-required', $annotations['group'], true ) ) {
|
||||
$this->skipWithoutMultisite();
|
||||
}
|
||||
if ( in_array( 'ms-excluded', $annotations['group'], true ) ) {
|
||||
$this->skipWithMultisite();
|
||||
}
|
||||
}
|
||||
|
||||
// Core tests no longer check against open Trac tickets, but others using WP_UnitTestCase may do so.
|
||||
if ( defined( 'WP_RUN_CORE_TESTS' ) && WP_RUN_CORE_TESTS ) {
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user