Skip to content
This repository has been archived by the owner on Nov 10, 2022. It is now read-only.

Commit

Permalink
Merge pull request #284 from xwp/update/activated-plugins
Browse files Browse the repository at this point in the history
Fix unit tests with WordPress 5.0
  • Loading branch information
westonruter authored Dec 4, 2018
2 parents ff2cfd2 + 1d8bcd9 commit c21a863
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
7 changes: 7 additions & 0 deletions check-diff.sh
Original file line number Diff line number Diff line change
Expand Up @@ -546,6 +546,9 @@ function install_wp {
elif [ "$WP_VERSION" == 'latest' ]; then
local TAG=$( svn ls https://develop.svn.wordpress.org/tags | tail -n 1 | sed 's:/$::' )
local SVN_URL="https://develop.svn.wordpress.org/tags/$TAG/"
elif [[ "$WP_VERSION" =~ ^[0-9]+\.[0-9]+$ ]]; then
# Use the release branch if no patch version supplied. This is useful to keep testing the latest minor version.
local SVN_URL="https://develop.svn.wordpress.org/branches/$WP_VERSION/"
else
local SVN_URL="https://develop.svn.wordpress.org/tags/$WP_VERSION/"
fi
Expand All @@ -554,6 +557,10 @@ function install_wp {

svn export -q "$SVN_URL" "$WP_CORE_DIR"

# Add workaround for running PHPUnit tests from source by touching built files.
mkdir -p "$WP_CORE_DIR/src/wp-includes/css/dist/block-library"
touch "$WP_CORE_DIR/src/wp-includes/css/dist/block-library/style.css"

download https://raw.github.com/markoheijnen/wp-mysqli/master/db.php "$WP_CORE_DIR/src/wp-content/db.php"
}

Expand Down
9 changes: 9 additions & 0 deletions phpunit-plugin-bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,15 @@ function xwp_filter_active_plugins_for_phpunit( $active_plugins ) {
} else if ( defined( 'WP_TEST_ACTIVATED_PLUGINS' ) ) {
$forced_active_plugins = preg_split( '/\s*,\s*/', WP_TEST_ACTIVATED_PLUGINS );
}

// Prevent loading feature plugins that have been merged.
if ( file_exists( ABSPATH . 'wp-includes/rest-api/endpoints/class-wp-rest-autosaves-controller.php' ) ) {
$forced_active_plugins = array_diff(
$forced_active_plugins,
array( 'gutenberg/gutenberg.php' )
);
}

if ( ! empty( $forced_active_plugins ) ) {
foreach ( $forced_active_plugins as $forced_active_plugin ) {
$active_plugins[] = $forced_active_plugin;
Expand Down

0 comments on commit c21a863

Please sign in to comment.