Skip to content

Commit

Permalink
Modernize install-wp-tests.sh script
Browse files Browse the repository at this point in the history
  • Loading branch information
swissspidy committed Nov 30, 2023
1 parent fa81018 commit f4b1275
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions bin/install-wp-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ SKIP_DB_CREATE=${6-false}
TMPDIR=${TMPDIR-/tmp}
TMPDIR=$(echo $TMPDIR | sed -e "s/\/$//")
WP_TESTS_DIR=${WP_TESTS_DIR-$TMPDIR/wordpress-tests-lib}
WP_TESTS_FILE="$WP_TESTS_DIR"/includes/functions.php
WP_CORE_DIR=${WP_CORE_DIR-$TMPDIR/wordpress/}
WP_CORE_FILE="$WP_CORE_DIR"/wp-includs.php

download() {
if [ `which curl` ]; then
Expand Down Expand Up @@ -59,10 +61,11 @@ set -ex

install_wp() {

if [ -d $WP_CORE_DIR ]; then
if [ -f $WP_CORE_FILE ]; then
return;
fi

rm -rf $WP_CORE_DIR
mkdir -p $WP_CORE_DIR

if [[ $WP_VERSION == 'nightly' || $WP_VERSION == 'trunk' ]]; then
Expand Down Expand Up @@ -106,9 +109,10 @@ install_test_suite() {
local ioption='-i'
fi

# set up testing suite if it doesn't yet exist
if [ ! -d $WP_TESTS_DIR ]; then
# set up testing suite if it doesn't yet exist or only partially exists
if [ ! -f $WP_TESTS_FILE ]; then
# set up testing suite
rm -rf $WP_TESTS_DIR
mkdir -p $WP_TESTS_DIR
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
Expand Down

0 comments on commit f4b1275

Please sign in to comment.