WordPress.org

Make WordPress Core

Changeset 49916


Ignore:
Timestamp:
01/02/2021 12:19:41 PM (10 months ago)
Author:
SergeyBiryukov
Message:

Build/Test Tools: Check if Travis/GitHub Actions environment variables are defined.

This adjusts the logic for determining whether to skip some tests when not in the primary branch, and allows for running these tests locally.

Follow-up to [47000], [47001], [49264], [49267], [49280].

See #50401.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/includes/abstract-testcase.php

    r49280 r49916  
    182182     * Allow tests to be skipped on some automated runs.
    183183     *
    184      * For test runs on Travis/GitHub Actions for something other than trunk/master, we want to skip tests that
    185      * only need to run for master.
     184     * For test runs on Travis/GitHub Actions for something other than trunk/master,
     185     * we want to skip tests that only need to run for master.
    186186     */
    187187    public function skipOnAutomatedBranches() {
     
    194194        $github_ref        = getenv( 'GITHUB_REF' );
    195195
    196         if ( 'false' !== $github_event_name ) {
     196        if ( $github_event_name && 'false' !== $github_event_name ) {
    197197            // We're on GitHub Actions.
    198198            $skipped = array( 'pull_request', 'pull_request_target' );
     
    201201                $this->markTestSkipped( 'For automated test runs, this test is only run on trunk/master' );
    202202            }
    203         } elseif ( 'false' !== $travis_branch ) {
     203        } elseif ( $travis_branch && 'false' !== $travis_branch ) {
    204204            // We're on Travis CI.
    205205            if ( 'master' !== $travis_branch || 'false' !== $travis_pull_request ) {
Note: See TracChangeset for help on using the changeset viewer.