From d4ecf9b34782f19008bc882ea3689b669f6a44f1 Mon Sep 17 00:00:00 2001 From: Chris Reynolds Date: Tue, 6 Feb 2024 11:33:55 -0700 Subject: [PATCH] setup nightly tests --- bin/phpunit-test.sh | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/bin/phpunit-test.sh b/bin/phpunit-test.sh index 60fb483..00fe291 100755 --- a/bin/phpunit-test.sh +++ b/bin/phpunit-test.sh @@ -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 @@ -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 --admin_email=test@dev.null --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" @@ -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