WordPress.org

Make WordPress Core

Changeset 48524


Ignore:
Timestamp:
07/21/2020 01:36:16 AM (2 months ago)
Author:
TimothyBlynJacobs
Message:

REST API: Make plugin installation tests more robust on alternate test environments.

The REST API plugin installation tests use the upgrader_pre_download filter to avoid downloading the test plugin from WordPress.org. Previously, this would apply to any upgrader, which caused issues if the testing environment required a language update.

Now, the filter only overwrites the file if the Plugin_Upgrader is being used which should hopefully prevent the issue.

Props pfefferle, TimothyBlynJacobs.
Fixes #50671.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/rest-api/rest-plugins-controller.php

    r48242 r48524  
    10141014        add_filter(
    10151015            'upgrader_pre_download',
    1016             function () {
    1017                 return DIR_TESTDATA . '/link-manager.zip';
    1018             }
     1016            static function ( $reply, $package, $upgrader ) {
     1017                if ( $upgrader instanceof Plugin_Upgrader ) {
     1018                    $reply = DIR_TESTDATA . '/link-manager.zip';
     1019                }
     1020
     1021                return $reply;
     1022            },
     1023            10,
     1024            3
    10191025        );
    10201026    }
Note: See TracChangeset for help on using the changeset viewer.