commit | author | age
|
63d4b1
|
1 |
#!/usr/bin/env php |
T |
2 |
<?php |
|
3 |
|
|
4 |
/* |
|
5 |
+-----------------------------------------------------------------------+ |
|
6 |
| tests/runtests.sh | |
|
7 |
| | |
|
8 |
| This file is part of the RoundCube Webmail client | |
|
9 |
| Copyright (C) 2009, RoundCube Dev. - Switzerland | |
|
10 |
| Licensed under the GNU GPL | |
|
11 |
| | |
|
12 |
| PURPOSE: | |
|
13 |
| Run-script for unit tests based on http://simpletest.org | |
|
14 |
| All .php files in this folder will be treated as tests | |
|
15 |
+-----------------------------------------------------------------------+ |
|
16 |
| Author: Thomas Bruederli <roundcube@gmail.com> | |
|
17 |
+-----------------------------------------------------------------------+ |
|
18 |
|
|
19 |
$Id: $ |
|
20 |
|
|
21 |
*/ |
|
22 |
|
|
23 |
if (php_sapi_name() != 'cli') |
|
24 |
die("Not in shell mode (php-cli)"); |
|
25 |
|
|
26 |
if (!defined('SIMPLETEST')) define('SIMPLETEST', '/www/simpletest/'); |
|
27 |
if (!defined('INSTALL_PATH')) define('INSTALL_PATH', realpath(dirname(__FILE__) . '/..') . '/' ); |
|
28 |
|
|
29 |
define('TESTS_DIR', dirname(__FILE__) . '/'); |
|
30 |
|
|
31 |
require_once(SIMPLETEST . 'unit_tester.php'); |
|
32 |
require_once(SIMPLETEST . 'reporter.php'); |
|
33 |
require_once(INSTALL_PATH . 'program/include/iniset.php'); |
|
34 |
|
|
35 |
if (count($_SERVER['argv']) > 1) { |
|
36 |
$testfiles = array(); |
|
37 |
for ($i=1; $i < count($_SERVER['argv']); $i++) |
|
38 |
$testfiles[] = realpath('./' . $_SERVER['argv'][$i]); |
|
39 |
} |
|
40 |
else { |
|
41 |
$testfiles = glob(TESTS_DIR . '*.php'); |
|
42 |
} |
|
43 |
|
|
44 |
$test = new TestSuite('RoundCube unit tests'); |
|
45 |
$reporter = new TextReporter(); |
|
46 |
|
|
47 |
foreach ($testfiles as $fn) { |
|
48 |
$test->addTestFile($fn); |
|
49 |
} |
|
50 |
|
|
51 |
$test->run($reporter); |
|
52 |
|
|
53 |
?> |