From d3726c7c0e497def97efcf610fdcac9bbebb0f3e Mon Sep 17 00:00:00 2001 From: Florian Pritz Date: Thu, 5 Feb 2015 21:49:12 +0100 Subject: Add simple testsuite Signed-off-by: Florian Pritz --- run-tests.sh | 59 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100755 run-tests.sh (limited to 'run-tests.sh') diff --git a/run-tests.sh b/run-tests.sh new file mode 100755 index 000000000..0b6cea761 --- /dev/null +++ b/run-tests.sh @@ -0,0 +1,59 @@ +#!/bin/bash +# +# This runs the testsuite +# +# If you have a local webserver call this script with it's URL. Otherwise the +# php dev server is used and that slows down tests a lot. +# + +startdir="$(dirname "$0")" +url="" +use_php_dev_server=0 + +if (($#>0)); then + url="$1" +fi + + +if [[ -z "$url" ]]; then + port=23115 + url="http://127.0.0.1:$port/index.php" + use_php_dev_server=1 +fi + +cd "$startdir" + +test -d system || exit 1 +test -d application || exit 1 +test -f run-tests.sh || exit 1 + +# prepare +cat <application/config/database-testsuite.php || exit 1 +/dev/null; do + sleep 0.2; + done +fi + +testpath="application/tests" +tests=($testpath/test_*.php) +tests=(${tests[@]#$testpath\/}) +tests=(${tests[@]%.php}) + +# run tests +php index.php tools update_database +prove -ve "php index.php tools test $url" "${tests[@]}" +php index.php tools drop_all_tables_using_prefix + +# cleanup +if ((use_php_dev_server)); then + kill $server_pid +fi +rm -f $startdir/application/config/database-testsuite.php -- cgit v1.2.3-24-g4f1b