Skip to content

Commit f847213

Browse files
committed
remove svn usage
props Gemini CLI
1 parent 2176805 commit f847213

File tree

1 file changed

+27
-16
lines changed

1 file changed

+27
-16
lines changed

templates/install-wp-tests.sh

Lines changed: 27 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,6 @@ download() {
3030
fi
3131
}
3232

33-
# Check if svn is installed
34-
check_svn_installed() {
35-
if ! command -v svn > /dev/null; then
36-
echo "Error: svn is not installed. Please install svn and try again."
37-
exit 1
38-
fi
39-
}
40-
4133
if [[ $WP_VERSION =~ ^[0-9]+\.[0-9]+\-(beta|RC)[0-9]+$ ]]; then
4234
WP_BRANCH=${WP_VERSION%\-*}
4335
WP_TESTS_TAG="branches/$WP_BRANCH"
@@ -76,10 +68,7 @@ install_wp() {
7668
mkdir -p $WP_CORE_DIR
7769

7870
if [[ $WP_VERSION == 'nightly' || $WP_VERSION == 'trunk' ]]; then
79-
mkdir -p $TMPDIR/wordpress-trunk
80-
check_svn_installed
81-
svn export --quiet https://core.svn.wordpress.org/trunk $TMPDIR/wordpress-trunk/wordpress
82-
mv $TMPDIR/wordpress-trunk/wordpress/* $WP_CORE_DIR
71+
download https://github.com/WordPress/wordpress-develop/archive/refs/heads/master.tar.gz $WP_CORE_DIR
8372
else
8473
if [ $WP_VERSION == 'latest' ]; then
8574
local ARCHIVE_NAME='latest'
@@ -120,13 +109,35 @@ install_test_suite() {
120109
# set up testing suite
121110
rm -rf $WP_TESTS_DIR
122111
mkdir -p $WP_TESTS_DIR
123-
check_svn_installed
124-
svn export --quiet --ignore-externals https://develop.svn.wordpress.org/${WP_TESTS_TAG}/tests/phpunit/includes/ $WP_TESTS_DIR/includes
125-
svn export --quiet --ignore-externals https://develop.svn.wordpress.org/${WP_TESTS_TAG}/tests/phpunit/data/ $WP_TESTS_DIR/data
112+
113+
if [[ $WP_TESTS_TAG == 'trunk' ]]; then
114+
ref=master
115+
archive_url="https://github.com/WordPress/wordpress-develop/archive/refs/heads/${ref}.tar.gz"
116+
elif [[ $WP_TESTS_TAG == branches/* ]]; then
117+
ref=${WP_TESTS_TAG#branches/}
118+
archive_url="https://github.com/WordPress/wordpress-develop/archive/refs/heads/${ref}.tar.gz"
119+
else
120+
ref=${WP_TESTS_TAG#tags/}
121+
archive_url="https://github.com/WordPress/wordpress-develop/archive/refs/tags/${ref}.tar.gz"
122+
fi
123+
124+
download ${archive_url} $TMPDIR/wordpress-develop.tar.gz
125+
tar -zxmf $TMPDIR/wordpress-develop.tar.gz -C $TMPDIR
126+
mv $TMPDIR/wordpress-develop-${ref}/tests/phpunit/includes $WP_TESTS_DIR/
127+
mv $TMPDIR/wordpress-develop-${ref}/tests/phpunit/data $WP_TESTS_DIR/
128+
rm -rf $TMPDIR/wordpress-develop-${ref}
129+
rm $TMPDIR/wordpress-develop.tar.gz
126130
fi
127131

128132
if [ ! -f wp-tests-config.php ]; then
129-
download https://develop.svn.wordpress.org/${WP_TESTS_TAG}/wp-tests-config-sample.php "$WP_TESTS_DIR"/wp-tests-config.php
133+
if [[ $WP_TESTS_TAG == 'trunk' ]]; then
134+
ref=master
135+
elif [[ $WP_TESTS_TAG == branches/* ]]; then
136+
ref=${WP_TESTS_TAG#branches/}
137+
else
138+
ref=${WP_TESTS_TAG#tags/}
139+
fi
140+
download https://raw.githubusercontent.com/WordPress/wordpress-develop/${ref}/wp-tests-config-sample.php "$WP_TESTS_DIR"/wp-tests-config.php
130141
# remove all forward slashes in the end
131142
WP_CORE_DIR=$(echo $WP_CORE_DIR | sed "s:/\+$::")
132143
sed $ioption "s:dirname( __FILE__ ) . '/src/':'$WP_CORE_DIR/':" "$WP_TESTS_DIR"/wp-tests-config.php

0 commit comments

Comments
 (0)