Skip to content

Commit

Permalink
setup nightly tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jazzsequence committed Feb 6, 2024
1 parent 439372c commit d4ecf9b
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions bin/phpunit-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,14 @@ set -e

DIRNAME=$(dirname "$0")

download() {
if [ "$(which curl)" ]; then
curl -s "$1" > "$2";
elif [ "$(which wget)" ]; then
wget -nv -O "$2" "$1"
fi
}

echo "🤔 Installing WP Unit tests..."
bash "${DIRNAME}/install-wp-tests.sh" wordpress_test root root 127.0.0.1 latest

Expand All @@ -21,6 +29,16 @@ bash "${DIRNAME}/install-wp-tests.sh" wordpress_test root root 127.0.0.1 latest
echo "🏃‍♂️ Running PHPUnit on Multisite"
composer test:multisite --ansi

setup_wp_nightly() {
download http://api.wordpress.org/core/version-check/1.7/ /tmp/wp-latest.json
echo "Creating wp-config.php"
wp config create --dbname=wordpress_test --dbuser=root --dbpass=root --dbhost=127.0.0.1 --dbprefix=wptests_ --path="${WP_CORE_DIR}"
wp core install --url=localhost --title=Test --admin_user=admin --admin_password=password [email protected] --path="${WP_CORE_DIR}"
# If nightly version of WP is installed, install latest Gutenberg plugin and activate it.
echo "Installing Gutenberg plugin"
wp plugin install gutenberg --activate --path="${WP_CORE_DIR}"
}

echo "🧹 Removing files before testing nightly WP..."
rm -rf "$WP_TESTS_DIR" "$WP_CORE_DIR"
rm "${DIRNAME}/../tests/wp-latest.json"
Expand All @@ -29,5 +47,8 @@ echo "🤔 Installing WP Unit tests with WP nightly version..."
bash "${DIRNAME}/install-wp-tests.sh" wordpress_test root root 127.0.0.1 nightly true
echo "📄 Copying wp-latest.json..."
cp /tmp/wp-latest.json "${DIRNAME}/../tests/wp-latest.json"

setup_wp_nightly

echo "🏃‍♂️ Running PHPUnit on Single Site (Nightly WordPress)"
composer phpunit --ansi

0 comments on commit d4ecf9b

Please sign in to comment.