Only install/activate Gutenberg plugin if WP version under test is earlier than 5.0.

This commit is contained in:
Jeff Stieler 2019-01-22 10:44:00 -07:00
parent e9bb73f23d
commit 2d4aea1971
2 changed files with 9 additions and 3 deletions

View File

@ -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 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 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 # Install Gutenberg if WP < 5
php wp-cli.phar plugin install gutenberg --activate 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 # Install WooCommerce
cd "wp-content/plugins/" cd "wp-content/plugins/"

View File

@ -94,7 +94,9 @@ function wc_test_includes() {
* Manually load the plugin being tested. * Manually load the plugin being tested.
*/ */
function _manually_load_plugin() { 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_TAX_ROUNDING_MODE', 'auto' );
define( 'WC_USE_TRANSACTIONS', false ); define( 'WC_USE_TRANSACTIONS', false );