Skip to content

Commit

Permalink
Make unit test install process a bit more resilient by removing exist…
Browse files Browse the repository at this point in the history
…ing dirs/dbs before adding. Inspiration from pods-framework.
  • Loading branch information
jtsternberg committed Mar 13, 2015
1 parent 25df9c6 commit da9dc83
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions tests/bin/install-wp-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ WP_CORE_DIR=/tmp/wordpress/
set -ex

install_wp() {
if [ $WP_CORE_DIR == '' ]; then
rm -rf $WP_CORE_DIR
fi

mkdir -p $WP_CORE_DIR

if [ $WP_VERSION == 'latest' ]; then
Expand All @@ -40,6 +44,10 @@ install_test_suite() {
fi

# set up testing suite
if [ $WP_TESTS_DIR == '' ]; then
rm -rf $WP_TESTS_DIR
fi

mkdir -p $WP_TESTS_DIR
cd $WP_TESTS_DIR
svn co --quiet http://develop.svn.wordpress.org/trunk/tests/phpunit/includes/
Expand Down Expand Up @@ -70,6 +78,9 @@ install_db() {
fi
fi

# drop database
mysql --user="$DB_USER" --password="$DB_PASS"$EXTRA -e "DROP DATABASE IF EXISTS $DB_NAME"

# create database
mysqladmin create $DB_NAME --user="$DB_USER" --password="$DB_PASS"$EXTRA
}
Expand Down

0 comments on commit da9dc83

Please sign in to comment.