WordPress.org

Make WordPress Core

Changeset 49491


Ignore:
Timestamp:
11/03/2020 09:07:33 PM (11 months ago)
Author:
desrosj
Message:

Build/Test Tools: Disable update attempts while running unit tests.

This fixes an issue introduced in [49369] that causes l10n related tests to fail when the PHPUnit test suite is run multiple times without hints of the site being under version control.

[49369] removed the .git folder from the ZIP artifact created during the initial setup job. This ZIP file is used by the later jobs in the workflow that run the test suite. The absence of the .git folder in these later jobs caused the language packs initially loaded from phpunit/data/languages folder to be updated asynchronously, resulting in unexpected values when running the tests a second time.

This change disables all Core auto-update and asynchronous language pack update attempts when running PHPUnit tests.

Props ocean90, SergeyBiryukov.
See #50401.
Fixes #51670.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/includes/bootstrap.php

    r49269 r49491  
    145145// Use the Spy REST Server instead of default.
    146146tests_add_filter( 'wp_rest_server_class', '_wp_rest_server_class_filter' );
     147// Prevent updating translations asynchronously.
     148tests_add_filter( 'async_update_translation', '__return_false' );
     149// Disable background updates.
     150tests_add_filter( 'automatic_updater_disabled', '__return_true' );
    147151
    148152// Preset WordPress options defined in bootstrap file.
Note: See TracChangeset for help on using the changeset viewer.