Skip to content

Commit

Permalink
Merge pull request #388 from Yoast/JRF/update-install-wp-script
Browse files Browse the repository at this point in the history
WP Tests: update install WP script
  • Loading branch information
jrfnl authored Dec 13, 2024
2 parents ff0758e + 3395b82 commit 0e753cf
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions config/scripts/install-wp-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
# Script to download and install WordPress for use in automated testing.
#
# Source: https://github.com/wp-cli/scaffold-command/blob/main/templates/install-wp-tests.sh
# Last updated based on commit https://github.com/wp-cli/scaffold-command/commit/503ac569875d3665a0b28b9a5b7e8d136112b6d6
# dated December 15 2022.
# Last updated based on commit https://github.com/wp-cli/scaffold-command/commit/efdc0aebe792eaa7ddf6725eae45d70fe6c6ce2a
# dated September 15 2024.
########################################################################

if [ $# -lt 3 ]; then
Expand All @@ -30,6 +30,17 @@ download() {
curl -s "$1" > "$2";
elif [ `which wget` ]; then
wget -nv -O "$2" "$1"
else
echo "Error: Neither curl nor wget is installed."
exit 1
fi
}

# Check if svn is installed
check_svn_installed() {
if ! command -v svn > /dev/null; then
echo "Error: svn is not installed. Please install svn and try again."
exit 1
fi
}

Expand Down Expand Up @@ -72,6 +83,7 @@ install_wp() {
if [[ $WP_VERSION == 'nightly' || $WP_VERSION == 'trunk' ]]; then
mkdir -p $TMPDIR/wordpress-trunk
rm -rf $TMPDIR/wordpress-trunk/*
check_svn_installed
svn export --quiet https://core.svn.wordpress.org/trunk $TMPDIR/wordpress-trunk/wordpress
mv $TMPDIR/wordpress-trunk/wordpress/* $WP_CORE_DIR
else
Expand Down Expand Up @@ -116,6 +128,7 @@ install_test_suite() {
# set up testing suite
mkdir -p $WP_TESTS_DIR
rm -rf $WP_TESTS_DIR/{includes,data}
check_svn_installed
svn export --quiet --ignore-externals https://develop.svn.wordpress.org/${WP_TESTS_TAG}/tests/phpunit/includes/ $WP_TESTS_DIR/includes
svn export --quiet --ignore-externals https://develop.svn.wordpress.org/${WP_TESTS_TAG}/tests/phpunit/data/ $WP_TESTS_DIR/data
fi
Expand Down

0 comments on commit 0e753cf

Please sign in to comment.