Ticket #50401: 50401.4.diff
File 50401.4.diff, 1.7 KB (added by , 4 years ago) |
---|
-
tests/phpunit/includes/abstract-testcase.php
181 181 /** 182 182 * Allow tests to be skipped on some automated runs. 183 183 * 184 * For test runs on Travis for something other than trunk/master 185 * we want to skip tests that only need to run for master. 184 * For test runs on Travis/GitHub Actions for something 185 * other than trunk/master, we want to skip tests that 186 * only need to run for master. 186 187 */ 187 188 public function skipOnAutomatedBranches() { 188 189 // https://docs.travis-ci.com/user/environment-variables/#Default-Environment-Variables 189 190 $travis_branch = getenv( 'TRAVIS_BRANCH' ); 190 191 $travis_pull_request = getenv( 'TRAVIS_PULL_REQUEST' ); 191 192 192 if ( ! $travis_branch || ! $travis_pull_request ) { 193 return; 194 } 193 // https://docs.github.com/en/free-pro-team@latest/actions/reference/environment-variables#default-environment-variables 194 $github_branch = getenv( 'GITHUB_REF' ); 195 195 196 if ( 'master' !== $travis_branch || 'false' !== $travis_pull_request ) { 197 $this->markTestSkipped( 'For automated test runs, this test is only run on trunk/master' ); 196 if ( $travis_branch && $travis_pull_request ) { 197 if ( 'master' !== $travis_branch || 'false' !== $travis_pull_request ) { 198 $this->markTestSkipped( 'For automated test runs, this test is only run on trunk/master' ); 199 } 200 } elseif ( $github_branch ) { 201 if ( false !== strpos( $github_branch, 'master' ) ) { 202 $this->markTestSkipped( 'For automated test runs, this test is only run on trunk/master' ); 203 } 198 204 } 199 205 } 200 206