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

Fix unit tests with WordPress 5.0 #284

Merged
merged 5 commits into from
Dec 4, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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/"
westonruter marked this conversation as resolved.
Show resolved Hide resolved
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