Make WordPress Core


Ignore:
Timestamp:
03/08/2017 12:10:29 AM (8 years ago)
Author:
johnbillion
Message:

Build/Test tools: In Travis, skip some tests when not on trunk.

This skips time sensitive tests (copyright year and PHP/MySQL version requirements) when tests are run on branches on Travis.

Props netweb, jorbin

Fixes #39486

Merges [40241] to the 4.5 branch.

Location:
branches/4.5
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/4.5

  • branches/4.5/tests/phpunit/includes/testcase.php

    r37071 r40242  
    160160        $_POST = array();
    161161        $this->flush_cache();
     162    }
     163
     164    /**
     165     * Allow tests to be skipped on some automated runs
     166     *
     167     * For test runs on Travis for something other than trunk/master
     168     * we want to skip tests that only need to run for master.
     169     */
     170    public function skipOnAutomatedBranches() {
     171        // gentenv can be disabled
     172        if ( ! function_exists( 'getenv' ) ) {
     173            return false;
     174        }
     175
     176        // https://docs.travis-ci.com/user/environment-variables/#Default-Environment-Variables
     177        $travis_branch       = getenv( 'TRAVIS_BRANCH' );
     178        $travis_pull_request = getenv( 'TRAVIS_PULL_REQUEST' );
     179
     180        if ( false !== $travis_pull_request && 'master' !== $travis_branch ) {
     181            $this->markTestSkipped( 'For automated test runs, this test is only run on trunk/master' );
     182        }
    162183    }
    163184
Note: See TracChangeset for help on using the changeset viewer.