commit | author | age
|
63d4b1
|
1 |
#!/usr/bin/env php |
T |
2 |
<?php |
|
3 |
|
|
4 |
/* |
|
5 |
+-----------------------------------------------------------------------+ |
|
6 |
| tests/runtests.sh | |
|
7 |
| | |
e019f2
|
8 |
| This file is part of the Roundcube Webmail client | |
f5e7b3
|
9 |
| Copyright (C) 2009, The Roundcube Dev Team | |
7fe381
|
10 |
| | |
T |
11 |
| Licensed under the GNU General Public License version 3 or | |
|
12 |
| any later version with exceptions for skins & plugins. | |
|
13 |
| See the README file for a full license statement. | |
63d4b1
|
14 |
| | |
T |
15 |
| PURPOSE: | |
|
16 |
| Run-script for unit tests based on http://simpletest.org | |
|
17 |
| All .php files in this folder will be treated as tests | |
|
18 |
+-----------------------------------------------------------------------+ |
|
19 |
| Author: Thomas Bruederli <roundcube@gmail.com> | |
|
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__) . '/'); |
684057
|
30 |
define('RCMAIL_CONFIG_DIR', TESTS_DIR . 'config'); |
63d4b1
|
31 |
|
T |
32 |
require_once(SIMPLETEST . 'unit_tester.php'); |
|
33 |
require_once(SIMPLETEST . 'reporter.php'); |
|
34 |
require_once(INSTALL_PATH . 'program/include/iniset.php'); |
|
35 |
|
|
36 |
if (count($_SERVER['argv']) > 1) { |
|
37 |
$testfiles = array(); |
|
38 |
for ($i=1; $i < count($_SERVER['argv']); $i++) |
|
39 |
$testfiles[] = realpath('./' . $_SERVER['argv'][$i]); |
|
40 |
} |
|
41 |
else { |
|
42 |
$testfiles = glob(TESTS_DIR . '*.php'); |
|
43 |
} |
|
44 |
|
e019f2
|
45 |
$test = new TestSuite('Roundcube unit tests'); |
63d4b1
|
46 |
$reporter = new TextReporter(); |
T |
47 |
|
|
48 |
foreach ($testfiles as $fn) { |
|
49 |
$test->addTestFile($fn); |
|
50 |
} |
|
51 |
|
|
52 |
$test->run($reporter); |
|
53 |
|
7fe381
|
54 |
?> |