From 412984769558627b1afe128bb505537ea4c6044d Mon Sep 17 00:00:00 2001 From: Weston Ruter Date: Mon, 22 Oct 2018 15:16:18 -0700 Subject: [PATCH 1/5] Prevent loading Gutenberg from WP_TEST_ACTIVATED_PLUGINS if merged --- phpunit-plugin-bootstrap.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/phpunit-plugin-bootstrap.php b/phpunit-plugin-bootstrap.php index a7377ad..1ad1a89 100644 --- a/phpunit-plugin-bootstrap.php +++ b/phpunit-plugin-bootstrap.php @@ -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; From 60dfe89bdfcd509cdf076e79730005246b14e54f Mon Sep 17 00:00:00 2001 From: Weston Ruter Date: Mon, 22 Oct 2018 20:27:30 -0700 Subject: [PATCH 2/5] Add support for installing WP from a branch --- check-diff.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/check-diff.sh b/check-diff.sh index 3e6768e..e01f809 100755 --- a/check-diff.sh +++ b/check-diff.sh @@ -546,6 +546,8 @@ 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]+\.[0-9]+ ]]; then + local SVN_URL="https://develop.svn.wordpress.org/branches/$WP_VERSION/" else local SVN_URL="https://develop.svn.wordpress.org/tags/$WP_VERSION/" fi From 291a1c890a28888fd2cb55579e859677b8fde39f Mon Sep 17 00:00:00 2001 From: Weston Ruter Date: Mon, 22 Oct 2018 20:45:18 -0700 Subject: [PATCH 3/5] Fix regex for branch check --- check-diff.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/check-diff.sh b/check-diff.sh index e01f809..5a25cea 100755 --- a/check-diff.sh +++ b/check-diff.sh @@ -546,7 +546,7 @@ 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]+\.[0-9]+ ]]; then + elif [[ "$WP_VERSION" =~ ^[0-9]+\.[0-9]+$ ]]; then local SVN_URL="https://develop.svn.wordpress.org/branches/$WP_VERSION/" else local SVN_URL="https://develop.svn.wordpress.org/tags/$WP_VERSION/" From e5c56ae44013f5f056ba97f35bd060a2b49e12f3 Mon Sep 17 00:00:00 2001 From: Weston Ruter Date: Wed, 24 Oct 2018 16:13:31 -0700 Subject: [PATCH 4/5] Add workaround for running PHPUnit tests from source by touching built files --- check-diff.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/check-diff.sh b/check-diff.sh index 5a25cea..1e56ba3 100755 --- a/check-diff.sh +++ b/check-diff.sh @@ -556,6 +556,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" } From 1d8bcd9077dd11401e639bccb3b779b742ea8fef Mon Sep 17 00:00:00 2001 From: Weston Ruter Date: Thu, 25 Oct 2018 09:27:17 -0700 Subject: [PATCH 5/5] Quote strings and add explanatory comment --- check-diff.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/check-diff.sh b/check-diff.sh index 1e56ba3..f9cc80a 100755 --- a/check-diff.sh +++ b/check-diff.sh @@ -547,6 +547,7 @@ function install_wp { 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/" @@ -557,8 +558,8 @@ 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 + 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" }