Skip to content

Commit 0e753cf

Browse files
authored
Merge pull request #388 from Yoast/JRF/update-install-wp-script
WP Tests: update install WP script
2 parents ff0758e + 3395b82 commit 0e753cf

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

config/scripts/install-wp-tests.sh

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
# Script to download and install WordPress for use in automated testing.
55
#
66
# Source: https://github.com/wp-cli/scaffold-command/blob/main/templates/install-wp-tests.sh
7-
# Last updated based on commit https://github.com/wp-cli/scaffold-command/commit/503ac569875d3665a0b28b9a5b7e8d136112b6d6
8-
# dated December 15 2022.
7+
# Last updated based on commit https://github.com/wp-cli/scaffold-command/commit/efdc0aebe792eaa7ddf6725eae45d70fe6c6ce2a
8+
# dated September 15 2024.
99
########################################################################
1010

1111
if [ $# -lt 3 ]; then
@@ -30,6 +30,17 @@ download() {
3030
curl -s "$1" > "$2";
3131
elif [ `which wget` ]; then
3232
wget -nv -O "$2" "$1"
33+
else
34+
echo "Error: Neither curl nor wget is installed."
35+
exit 1
36+
fi
37+
}
38+
39+
# Check if svn is installed
40+
check_svn_installed() {
41+
if ! command -v svn > /dev/null; then
42+
echo "Error: svn is not installed. Please install svn and try again."
43+
exit 1
3344
fi
3445
}
3546

@@ -72,6 +83,7 @@ install_wp() {
7283
if [[ $WP_VERSION == 'nightly' || $WP_VERSION == 'trunk' ]]; then
7384
mkdir -p $TMPDIR/wordpress-trunk
7485
rm -rf $TMPDIR/wordpress-trunk/*
86+
check_svn_installed
7587
svn export --quiet https://core.svn.wordpress.org/trunk $TMPDIR/wordpress-trunk/wordpress
7688
mv $TMPDIR/wordpress-trunk/wordpress/* $WP_CORE_DIR
7789
else
@@ -116,6 +128,7 @@ install_test_suite() {
116128
# set up testing suite
117129
mkdir -p $WP_TESTS_DIR
118130
rm -rf $WP_TESTS_DIR/{includes,data}
131+
check_svn_installed
119132
svn export --quiet --ignore-externals https://develop.svn.wordpress.org/${WP_TESTS_TAG}/tests/phpunit/includes/ $WP_TESTS_DIR/includes
120133
svn export --quiet --ignore-externals https://develop.svn.wordpress.org/${WP_TESTS_TAG}/tests/phpunit/data/ $WP_TESTS_DIR/data
121134
fi

0 commit comments

Comments
 (0)