mirror of
https://github.com/dg/dibi.git
synced 2025-02-23 02:12:25 +01:00
updated test support files
This commit is contained in:
parent
d4c72bbd4d
commit
e99ce9d053
@ -10,7 +10,11 @@ matrix:
|
||||
allow_failures:
|
||||
- php: hhvm
|
||||
|
||||
script: VERBOSE=true ./tests/run-tests.sh -s tests/
|
||||
script: vendor/bin/tester tests -s -c tests/php-unix.ini
|
||||
|
||||
after_failure:
|
||||
# Print *.actual content
|
||||
- for i in $(find tests -name \*.actual); do echo "--- $i"; cat $i; echo; echo; done
|
||||
|
||||
before_script:
|
||||
# Install Nette Tester
|
||||
|
@ -14,7 +14,7 @@
|
||||
"php": ">=5.2.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"nette/tester": "@dev"
|
||||
"nette/tester": "~1.1"
|
||||
},
|
||||
"replace": {
|
||||
"dg/dibi": "self.version"
|
||||
|
@ -1,13 +1,18 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Test initialization and helpers.
|
||||
*
|
||||
* @author David Grudl
|
||||
*/
|
||||
// The Nette Tester command-line runner can be
|
||||
// invoked through the command: ../../vendor/bin/tester .
|
||||
|
||||
require __DIR__ . '/../../vendor/nette/tester/Tester/bootstrap.php';
|
||||
require __DIR__ . '/../../dibi/dibi.php';
|
||||
$config = require __DIR__ . '/config.php';
|
||||
if (@!include __DIR__ . '/../../vendor/autoload.php') {
|
||||
echo 'Install Nette Tester using `composer update --dev`';
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
||||
// configure environment
|
||||
Tester\Environment::setup();
|
||||
date_default_timezone_set('Europe/Prague');
|
||||
|
||||
|
||||
// load connections
|
||||
$config = require __DIR__ . '/config.php';
|
||||
|
@ -1,11 +0,0 @@
|
||||
@ECHO OFF
|
||||
|
||||
IF NOT EXIST "%~dp0..\vendor\nette\tester" (
|
||||
ECHO Nette Tester is missing. You can install it using Composer:
|
||||
ECHO php composer.phar update --dev
|
||||
EXIT /B 2
|
||||
)
|
||||
|
||||
php -n "%~dp0..\vendor\nette\tester\Tester\tester.php" -p php-cgi.exe -c "%~dp0php-win.ini" -j 20 -log "%~dp0test.log" %*
|
||||
|
||||
rmdir "%~dp0/tmp" /S /Q
|
@ -1,51 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Path to this script's directory
|
||||
dir=$(cd `dirname $0` && pwd)
|
||||
|
||||
# Path to test runner script
|
||||
runnerScript="$dir/../vendor/nette/tester/Tester/tester.php"
|
||||
if [ ! -f "$runnerScript" ]; then
|
||||
echo "Nette Tester is missing. You can install it using Composer:" >&2
|
||||
echo "php composer.phar update --dev." >&2
|
||||
exit 2
|
||||
fi
|
||||
|
||||
# Default runner arguments
|
||||
jobsNum=20
|
||||
phpIni="$dir/php-unix.ini"
|
||||
|
||||
# Command line arguments processing
|
||||
i=$#
|
||||
while [ $i -gt 0 ]; do
|
||||
if [ "$1" = "-j" ]; then
|
||||
shift && i=$(($i - 1))
|
||||
if [ -z "$1" ]; then
|
||||
echo "Missing argument for -j option." >&2
|
||||
exit 2
|
||||
fi
|
||||
jobsNum="$1"
|
||||
|
||||
elif [ "$1" = "-c" ]; then
|
||||
shift && i=$(($i - 1))
|
||||
if [ -z "$1" ]; then
|
||||
echo "Missing argument for -c option." >&2
|
||||
exit 2
|
||||
fi
|
||||
phpIni="$1"
|
||||
|
||||
else
|
||||
set -- "$@" "$1"
|
||||
fi
|
||||
shift && i=$(($i - 1))
|
||||
done
|
||||
|
||||
# Run tests with script's arguments, doubled -c option intentionally
|
||||
php -n -c "$phpIni" "$runnerScript" -j "$jobsNum" -c "$phpIni" "$@"
|
||||
error=$?
|
||||
|
||||
# Print *.actual content if tests failed
|
||||
if [ "${VERBOSE-false}" != "false" -a $error -ne 0 ]; then
|
||||
for i in $(find "$dir" -name \*.actual); do echo "--- $i"; cat $i; echo; echo; done
|
||||
exit $error
|
||||
fi
|
Loading…
x
Reference in New Issue
Block a user