From 2d4aea19713b05d456fe66bc9af0db08ac944d95 Mon Sep 17 00:00:00 2001 From: Jeff Stieler Date: Tue, 22 Jan 2019 10:44:00 -0700 Subject: [PATCH] Only install/activate Gutenberg plugin if WP version under test is earlier than 5.0. --- plugins/woocommerce-admin/bin/install-wp-tests.sh | 8 ++++++-- plugins/woocommerce-admin/tests/bootstrap.php | 4 +++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/plugins/woocommerce-admin/bin/install-wp-tests.sh b/plugins/woocommerce-admin/bin/install-wp-tests.sh index 2f4867f336e..b88529cd819 100755 --- a/plugins/woocommerce-admin/bin/install-wp-tests.sh +++ b/plugins/woocommerce-admin/bin/install-wp-tests.sh @@ -168,8 +168,12 @@ install_deps() { php wp-cli.phar core config --dbname=$DB_NAME --dbuser=$DB_USER --dbpass=$DB_PASS --dbhost=$DB_HOST --dbprefix=wptests_ php wp-cli.phar core install --url="$WP_SITE_URL" --title="Example" --admin_user=admin --admin_password=password --admin_email=info@example.com --path=$WP_CORE_DIR --skip-email - # Install Gutenberg - php wp-cli.phar plugin install gutenberg --activate + # Install Gutenberg if WP < 5 + if [[ $WP_VERSION =~ ^([0-9]+)[0-9\.]+\-? ]]; then + if [ "5" -gt "${BASH_REMATCH[1]}" ]; then + php wp-cli.phar plugin install gutenberg --activate + fi + fi # Install WooCommerce cd "wp-content/plugins/" diff --git a/plugins/woocommerce-admin/tests/bootstrap.php b/plugins/woocommerce-admin/tests/bootstrap.php index 616c248cb18..bc8866a4c6b 100755 --- a/plugins/woocommerce-admin/tests/bootstrap.php +++ b/plugins/woocommerce-admin/tests/bootstrap.php @@ -94,7 +94,9 @@ function wc_test_includes() { * Manually load the plugin being tested. */ function _manually_load_plugin() { - require dirname( dirname( dirname( __FILE__ ) ) ) . '/gutenberg/gutenberg.php'; + if ( version_compare( $GLOBALS['wp_version'], '4.9.9', '<=' ) ) { // < 5.0 fails for "5.0-alpha-12345-src + require dirname( dirname( dirname( __FILE__ ) ) ) . '/gutenberg/gutenberg.php'; + } define( 'WC_TAX_ROUNDING_MODE', 'auto' ); define( 'WC_USE_TRANSACTIONS', false );