diff --git a/tests/phpunit/includes/abstract-testcase.php b/tests/phpunit/includes/abstract-testcase.php index 39aa893295..4dbbea959f 100644 --- a/tests/phpunit/includes/abstract-testcase.php +++ b/tests/phpunit/includes/abstract-testcase.php @@ -181,8 +181,8 @@ abstract class WP_UnitTestCase_Base extends PHPUnit\Framework\TestCase { /** * Allow tests to be skipped on some automated runs. * - * For test runs on Travis/GitHub Actions for something other than trunk/master, we want to skip tests that - * only need to run for master. + * For test runs on Travis/GitHub Actions for something other than trunk/master, + * we want to skip tests that only need to run for master. */ public function skipOnAutomatedBranches() { // https://docs.travis-ci.com/user/environment-variables/#Default-Environment-Variables @@ -193,14 +193,14 @@ abstract class WP_UnitTestCase_Base extends PHPUnit\Framework\TestCase { $github_event_name = getenv( 'GITHUB_EVENT_NAME' ); $github_ref = getenv( 'GITHUB_REF' ); - if ( 'false' !== $github_event_name ) { + if ( $github_event_name && 'false' !== $github_event_name ) { // We're on GitHub Actions. $skipped = array( 'pull_request', 'pull_request_target' ); if ( in_array( $github_event_name, $skipped, true ) || 'refs/heads/master' !== $github_ref ) { $this->markTestSkipped( 'For automated test runs, this test is only run on trunk/master' ); } - } elseif ( 'false' !== $travis_branch ) { + } elseif ( $travis_branch && 'false' !== $travis_branch ) { // We're on Travis CI. if ( 'master' !== $travis_branch || 'false' !== $travis_pull_request ) { $this->markTestSkipped( 'For automated test runs, this test is only run on trunk/master' );