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

Commit

Permalink
Return an error when installing unit tests if WP < 5 (#1645)
Browse files Browse the repository at this point in the history
  • Loading branch information
justinshreve committed Feb 22, 2019
1 parent 2d0b05c commit 0d8592e
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions bin/install-wp-tests.sh
Expand Up @@ -17,6 +17,14 @@ TMPDIR=$(echo $TMPDIR | sed -e "s/\/$//")
WP_TESTS_DIR=${WP_TESTS_DIR-$TMPDIR/wordpress-tests-lib}
WP_CORE_DIR=${WP_CORE_DIR-$TMPDIR/wordpress/}

# Error if WP < 5
if [[ $WP_VERSION =~ ^([0-9]+)[0-9\.]+\-? ]]; then
if [ "5" -gt "${BASH_REMATCH[1]}" ]; then
echo "You must use WordPress 5.0 or greater."
exit 1
fi
fi

download() {
if [ `which curl` ]; then
curl -s "$1" > "$2";
Expand Down Expand Up @@ -168,13 +176,6 @@ 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 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/"
# As zip file does not include tests, we have to get it from git repo.
Expand Down

0 comments on commit 0d8592e

Please sign in to comment.