MDL-32323 all-in-one PHPUnit init script

This commit is contained in:
Petr Skoda 2012-04-04 21:06:01 +02:00
parent 6aaae357c9
commit 4b17369567
4 changed files with 32 additions and 6 deletions

24
admin/tool/phpunit/cli/init.sh Executable file
View file

@ -0,0 +1,24 @@
#!/bin/bash
CLIDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
UTIL="$CLIDIR/util.php"
echo "Building phpunit.xml and initialising test database..."
php $UTIL --buildconfig
RESULT=$?
if [ $RESULT -gt 0 ] ; then
exit $RESULT
fi
php $UTIL --drop
RESULT=$?
if [ $RESULT -gt 0 ] ; then
exit $RESULT
fi
php $UTIL --install
RESULT=$?
if [ $RESULT -gt 0 ] ; then
exit $RESULT
fi

View file

@ -31,6 +31,12 @@
define('PHPUNIT_UTIL', true);
// verify PHPUnit installation
if (!@include_once('PHPUnit/Autoload.php')) {
fwrite(STDERR, "Can not load PHPUnit PEAR library, is it installed?\n");
exit(1);
}
require(__DIR__ . '/../../../../lib/phpunit/bootstrap.php');
require_once($CFG->libdir.'/phpunit/lib.php');
require_once($CFG->libdir.'/adminlib.php');