Skip to content

Instantly share code, notes, and snippets.

@PVince81
Created October 25, 2017 12:53
Show Gist options
  • Save PVince81/5c4817049d8573dac0a60b29ddcf02fe to your computer and use it in GitHub Desktop.
Save PVince81/5c4817049d8573dac0a60b29ddcf02fe to your computer and use it in GitHub Desktop.
Run OC tests
#!/bin/bash
TEST_SUITE="$1"
SEARCH_FOLDERS="apps/*/tests tests/lib tests/unit"
if test -z "$TEST_SUITE"; then
if test -r Makefile; then
make test-php TEST_DATABASE=sqlite 2>&1 | tee octest.log
else
./autotest.sh sqlite 2>&1 | tee octest.log
fi
else
if ! test -r "$TEST_SUITE"; then
# Try and find it
TEST_SUITE_FOUND=$(find $SEARCH_FOLDERS -iname \*"$TEST_SUITE".php | xargs echo)
if test -z "$TEST_SUITE_FOUND"; then
echo "Test suite \"$TEST_SUITE\" not found" <&2
exit 2
fi
TEST_SUITE="$TEST_SUITE_FOUND"
echo "Found test suite(s): $TEST_SUITE"
fi
if test -r Makefile; then
make test-php TEST_DATABASE=sqlite TEST_PHP_SUITE="$TEST_SUITE" 2>&1 | tee octest.log
else
./autotest.sh sqlite "$TEST_SUITE" 2>&1 | tee octest.log
fi
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment