reset_dir "$OUTDIR/bundled-indiv"
pushd "$CIVI/tools"
- phpunit-indiv --civi "../$TESTPATH" "$OUTDIR/bundled-indiv"
+ ./scripts/phpunit-indiv --civi --test-dir "../$TESTPATH" --json-dir "$OUTDIR/bundled-indiv"
popd
cat "$OUTDIR"/bundled-indiv/*-*.json > "$OUTDIR/bundled-indiv/all.json"
pushd "$CIVI"
[ -d "packages/PHPUnit" ] && mv "packages/PHPUnit" "packages/PHPUnit.bak"
- phpunit-indiv "$TESTPATH" "$OUTDIR/standalone-indiv"
+ ./tools/scripts/phpunit-indiv --test-dir "$TESTPATH" --json-dir "$OUTDIR/standalone-indiv"
[ -d "packages/PHPUnit.bak" ] && mv "packages/PHPUnit.bak" "packages/PHPUnit"
popd
PHP=${PHP:-php}
PHPUNIT=${PHPUNIT:-phpunit}
MODE=standalone
+XMLDIR=
+JSONDIR=
-if [ "$1" == "--civi" ]; then
- MODE=civi
+while [ -n "$1" ]; do
+ ARG="$1"
shift
-fi
-TESTSUITE="$1"
-shift
+ case "$ARG" in
+ --civi)
+ MODE=civi
+ ;;
+ --test-dir)
+ TESTSUITE="$1"
+ shift
+ ;;
+ --json-dir)
+ JSONDIR="$1"
+ [ ! -d "$JSONDIR" ] && mkdir -p "$JSONDIR"
+ shift
+ ;;
+ --xml-dir)
+ XMLDIR="$1"
+ [ ! -d "$XMLDIR" ] && mkdir -p "$XMLDIR"
+ shift
+ ;;
+ *)
+ echo "unrecognized option: $ARG"
+ ;;
+ esac
+done
-OUTDIR="$1"
-shift
-if [ -z "$TESTSUITE" -o -z "$OUTDIR" ]; then
+if [ -z "$TESTSUITE" ]; then
echo "summary: Executes all tests in a suite (individually)"
- echo "usage: $0 <test-suite-path> <output-dir>"
+ echo "usage: $0 --test-dir <dir> [--json-dir <dir>] [--xml-dir <dir>] [--civi]"
exit 1
fi
-[ ! -d "$OUTDIR" ] && mkdir -p "$OUTDIR"
#phpunit-ls "$TESTSUITE"
phpunit-ls "$TESTSUITE" | while read FILE CLASS METHOD ; do
+ PHPUNITARGS="--tap"
+ if [ -n "$JSONDIR" ]; then
+ PHPUNITARGS="$PHPUNITARGS --log-json $JSONDIR/$CLASS-$METHOD.json"
+ fi
+ if [ -n "$XMLDIR" ]; then
+ PHPUNITARGS="$PHPUNITARGS --log-junit $XMLDIR/$CLASS-$METHOD.xml"
+ fi
+
+
if [ "$MODE" == "civi" ]; then
- $PHP ./scripts/phpunit --tap --log-json "$OUTDIR/$CLASS-$METHOD.json" --filter $METHOD'( with.*)?$' "$CLASS"
+ $PHP ./scripts/phpunit $PHPUNITARGS --filter $METHOD'( with.*)?$' "$CLASS"
fi
if [ "$MODE" == "standalone" ]; then
- $PHP $(which $PHPUNIT) --tap --log-json "$OUTDIR/$CLASS-$METHOD.json" --filter $METHOD'( with.*)?$' "$FILE"
+ $PHP $(which $PHPUNIT) $PHPUNITARGS --filter $METHOD'( with.*)?$' "$FILE"
fi
done