mirror of
https://github.com/dg/dibi.git
synced 2025-08-04 05:07:36 +02:00
added .travis.yml & other files
This commit is contained in:
11
.travis.yml
Normal file
11
.travis.yml
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
language: php
|
||||||
|
php:
|
||||||
|
- 5.3.3
|
||||||
|
- 5.4
|
||||||
|
- 5.5
|
||||||
|
|
||||||
|
script: VERBOSE=true ./tests/run-tests.sh -s tests/
|
||||||
|
|
||||||
|
before_script:
|
||||||
|
# Install Nette Tester
|
||||||
|
- composer install --no-interaction --dev
|
@@ -16,3 +16,9 @@ Refer to the `examples` directory for examples. Dibi documentation is
|
|||||||
available on the [homepage](http://dibiphp.com).
|
available on the [homepage](http://dibiphp.com).
|
||||||
|
|
||||||
Dibi requires PHP 5.2.0 or later. It has been tested with PHP 5.5 too.
|
Dibi requires PHP 5.2.0 or later. It has been tested with PHP 5.5 too.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
-----
|
||||||
|
|
||||||
|
[](http://travis-ci.org/dg/dibi)
|
||||||
|
4
tests/.gitignore
vendored
Normal file
4
tests/.gitignore
vendored
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
/*/output
|
||||||
|
/coverage.dat
|
||||||
|
/test.log
|
||||||
|
/tmp
|
11
tests/RunTests.bat
Normal file
11
tests/RunTests.bat
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
@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.exe -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,18 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Test initialization and helpers.
|
|
||||||
*
|
|
||||||
* @author David Grudl
|
|
||||||
* @package Nette\Test
|
|
||||||
*/
|
|
||||||
|
|
||||||
require dirname(__FILE__) . '/../vendor/nette/tester/Tester/bootstrap.php';
|
|
||||||
require dirname(__FILE__) . '/../dibi/dibi.php';
|
|
||||||
|
|
||||||
date_default_timezone_set('Europe/Prague');
|
|
||||||
class_alias('Tester\Assert', 'Assert');
|
|
||||||
|
|
||||||
// load connections
|
|
||||||
define('DIR', dirname(__FILE__));
|
|
||||||
$config = parse_ini_file(dirname(__FILE__) . '/config.ini', TRUE);
|
|
@@ -1,67 +0,0 @@
|
|||||||
[mysql]
|
|
||||||
driver = mysql
|
|
||||||
host = localhost
|
|
||||||
username = dibi
|
|
||||||
password = dibi
|
|
||||||
database = dibi_test
|
|
||||||
charset = utf8
|
|
||||||
|
|
||||||
[mysqli]
|
|
||||||
driver = mysqli
|
|
||||||
host = localhost
|
|
||||||
username = dibi
|
|
||||||
password = dibi
|
|
||||||
database = dibi_test
|
|
||||||
charset = utf8
|
|
||||||
|
|
||||||
[sqlite]
|
|
||||||
driver = sqlite
|
|
||||||
database = DIR "/data/sample.sdb"
|
|
||||||
|
|
||||||
[sqlite3]
|
|
||||||
driver = sqlite3
|
|
||||||
database = DIR "/data/sample.sdb3"
|
|
||||||
|
|
||||||
[odbc]
|
|
||||||
driver = odbc
|
|
||||||
username = dibi
|
|
||||||
password = dibi
|
|
||||||
dsn = "Driver={Microsoft Access Driver (*.mdb)};Dbq=" DIR "/data/sample.mdb"
|
|
||||||
|
|
||||||
[postgresql]
|
|
||||||
driver = postgre
|
|
||||||
host = localhost
|
|
||||||
port = 5432
|
|
||||||
username = dibi
|
|
||||||
password = dibi
|
|
||||||
database = dibi_test
|
|
||||||
persistent = TRUE
|
|
||||||
|
|
||||||
[sqlite-pdo]
|
|
||||||
driver = pdo
|
|
||||||
dsn = "sqlite2::" DIR "/data/sample.sdb"
|
|
||||||
|
|
||||||
[mysql-pdo]
|
|
||||||
driver = pdo
|
|
||||||
dsn = "mysql:dbname=dibi_test;host=localhost"
|
|
||||||
username = dibi
|
|
||||||
password = dibi
|
|
||||||
|
|
||||||
[mssql]
|
|
||||||
driver = mssql
|
|
||||||
host = localhost
|
|
||||||
username = dibi
|
|
||||||
password = dibi
|
|
||||||
|
|
||||||
[mssql2005]
|
|
||||||
driver = mssql2005
|
|
||||||
host = "(local)"
|
|
||||||
username = dibi
|
|
||||||
password = dibi
|
|
||||||
database = dibi_test
|
|
||||||
|
|
||||||
[oracle]
|
|
||||||
driver = oracle
|
|
||||||
username = dibi
|
|
||||||
password = dibi
|
|
||||||
database = dibi_test
|
|
@@ -8,8 +8,7 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
require dirname(__FILE__) . '/bootstrap.php';
|
require __DIR__ . '/bootstrap.php';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
dibi::connect($config['sqlite3']);
|
dibi::connect($config['sqlite3']);
|
14
tests/dibi/bootstrap.php
Normal file
14
tests/dibi/bootstrap.php
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test initialization and helpers.
|
||||||
|
*
|
||||||
|
* @author David Grudl
|
||||||
|
*/
|
||||||
|
|
||||||
|
require __DIR__ . '/../../vendor/nette/tester/Tester/bootstrap.php';
|
||||||
|
require __DIR__ . '/../../dibi/dibi.php';
|
||||||
|
$config = require __DIR__ . '/config.php';
|
||||||
|
|
||||||
|
date_default_timezone_set('Europe/Prague');
|
||||||
|
class_alias('Tester\Assert', 'Assert');
|
77
tests/dibi/config.php
Normal file
77
tests/dibi/config.php
Normal file
@@ -0,0 +1,77 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
return array(
|
||||||
|
'mysql' => array(
|
||||||
|
'driver' => 'mysql',
|
||||||
|
'host' => 'localhost',
|
||||||
|
'username' => 'root',
|
||||||
|
'password' => 'xxx',
|
||||||
|
'charset' => 'utf8',
|
||||||
|
),
|
||||||
|
|
||||||
|
'mysqli' => array(
|
||||||
|
'driver' => 'mysqli',
|
||||||
|
'host' => 'localhost',
|
||||||
|
'username' => 'dibi',
|
||||||
|
'password' => 'dibi',
|
||||||
|
'charset' => 'utf8',
|
||||||
|
),
|
||||||
|
|
||||||
|
'sqlite' => array(
|
||||||
|
'driver' => 'sqlite',
|
||||||
|
'database' => dirname(__FILE__) . '/data/sample.sdb',
|
||||||
|
),
|
||||||
|
|
||||||
|
'sqlite3' => array(
|
||||||
|
'driver' => 'sqlite3',
|
||||||
|
'database' => dirname(__FILE__) . '/data/sample.sdb3',
|
||||||
|
),
|
||||||
|
|
||||||
|
'odbc' => array(
|
||||||
|
'driver' => 'odbc',
|
||||||
|
'username' => 'dibi',
|
||||||
|
'password' => 'dibi',
|
||||||
|
'dsn' => 'Driver={Microsoft Access Driver (*.mdb)};Dbq=' . dirname(__FILE__) . '/data/sample.mdb',
|
||||||
|
),
|
||||||
|
|
||||||
|
'postgresql' => array(
|
||||||
|
'driver' => 'postgre',
|
||||||
|
'host' => 'localhost',
|
||||||
|
'port' => '5432',
|
||||||
|
'username' => 'dibi',
|
||||||
|
'password' => 'dibi',
|
||||||
|
'persistent' => '1',
|
||||||
|
),
|
||||||
|
|
||||||
|
'sqlite-pdo' => array(
|
||||||
|
'driver' => 'pdo',
|
||||||
|
'dsn' => 'sqlite2::' . dirname(__FILE__) . '/data/sample.sdb',
|
||||||
|
),
|
||||||
|
|
||||||
|
'mysql-pdo' => array(
|
||||||
|
'driver' => 'pdo',
|
||||||
|
'dsn' => 'mysql:host=localhost',
|
||||||
|
'username' => 'dibi',
|
||||||
|
'password' => 'dibi',
|
||||||
|
),
|
||||||
|
|
||||||
|
'mssql' => array(
|
||||||
|
'driver' => 'mssql',
|
||||||
|
'host' => 'localhost',
|
||||||
|
'username' => 'dibi',
|
||||||
|
'password' => 'dibi',
|
||||||
|
),
|
||||||
|
|
||||||
|
'mssql2005' => array(
|
||||||
|
'driver' => 'mssql2005',
|
||||||
|
'host' => '(local)',
|
||||||
|
'username' => 'dibi',
|
||||||
|
'password' => 'dibi',
|
||||||
|
),
|
||||||
|
|
||||||
|
'oracle' => array(
|
||||||
|
'driver' => 'oracle',
|
||||||
|
'username' => 'dibi',
|
||||||
|
'password' => 'dibi',
|
||||||
|
),
|
||||||
|
);
|
2
tests/php-unix.ini
Normal file
2
tests/php-unix.ini
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
[PHP]
|
||||||
|
;extension_dir = "./ext"
|
3
tests/php-win.ini
Normal file
3
tests/php-win.ini
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
[PHP]
|
||||||
|
extension_dir = "./ext"
|
||||||
|
extension=php_sqlite3.dll
|
50
tests/run-tests.sh
Executable file
50
tests/run-tests.sh
Executable file
@@ -0,0 +1,50 @@
|
|||||||
|
#!/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
|
||||||
|
for i in `seq 1 $#`; do
|
||||||
|
if [ "$1" = "-j" ]; then
|
||||||
|
shift
|
||||||
|
if [ -z "$1" ]; then
|
||||||
|
echo "Missing argument for -j option." >&2
|
||||||
|
exit 2
|
||||||
|
fi
|
||||||
|
jobsNum="$1"
|
||||||
|
|
||||||
|
elif [ "$1" = "-c" ]; then
|
||||||
|
shift
|
||||||
|
if [ -z "$1" ]; then
|
||||||
|
echo "Missing argument for -c option." >&2
|
||||||
|
exit 2
|
||||||
|
fi
|
||||||
|
phpIni="$1"
|
||||||
|
|
||||||
|
else
|
||||||
|
set -- "$@" "$1"
|
||||||
|
fi
|
||||||
|
shift
|
||||||
|
done
|
||||||
|
|
||||||
|
# Run tests with script's arguments, doubled -c option intentionally
|
||||||
|
php -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 . -name \*.actual); do echo "--- $i"; cat $i; echo; echo; done
|
||||||
|
exit $error
|
||||||
|
fi
|
Reference in New Issue
Block a user