From 5878c6708ef7eac0d44604df72fb299ce8cd6a0b Mon Sep 17 00:00:00 2001 From: Tim Otten Date: Thu, 14 Aug 2014 14:23:20 -0700 Subject: [PATCH] INFRA-125 - phpunit-indiv - Add option to fully reset DBs in between tests --- tools/scripts/phpunit-indiv | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/tools/scripts/phpunit-indiv b/tools/scripts/phpunit-indiv index cdec728ac6..c681c56be4 100755 --- a/tools/scripts/phpunit-indiv +++ b/tools/scripts/phpunit-indiv @@ -20,6 +20,10 @@ while [ -n "$1" ]; do --civi) MODE=civi ;; + --civibuild-restore) + CIVIBUILD_RESTORE="$1" + shift + ;; --test-dir) TESTSUITE="$1" shift @@ -43,13 +47,19 @@ done if [ -z "$TESTSUITE" ]; then echo "summary: Executes all tests in a suite (individually)" - echo "usage: $0 --test-dir [--json-dir ] [--xml-dir ] [--civi]" + echo "usage: $0 --test-dir [--json-dir ] [--xml-dir ] [--civi] [--civibuild-restore ]" exit 1 fi #phpunit-ls "$TESTSUITE" $BINDIR/phpunit-ls "$TESTSUITE" | while read FILE CLASS METHOD ; do + ## Optionally reset DBs + if [ -n "$CIVIBUILD_RESTORE" ]; then + civibuild restore "$CIVIBUILD_RESTORE" + fi + + ## Prepare test command PHPUNITARGS="--tap" if [ -n "$JSONDIR" ]; then PHPUNITARGS="$PHPUNITARGS --log-json $JSONDIR/$CLASS-$METHOD.json" @@ -58,7 +68,7 @@ $BINDIR/phpunit-ls "$TESTSUITE" | while read FILE CLASS METHOD ; do PHPUNITARGS="$PHPUNITARGS --log-junit $XMLDIR/$CLASS-$METHOD.xml" fi - + ## Run the test! if [ "$MODE" == "civi" ]; then $PHP ./scripts/phpunit $PHPUNITARGS --filter $METHOD'( with.*)?$' "$CLASS" fi -- 2.25.1