thomascube
2012-01-27 77c779a2b807cdde0641267f272517738157edf4
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  $Id:  $
23
24 */
25
26 if (php_sapi_name() != 'cli')
27   die("Not in shell mode (php-cli)");
28
29 if (!defined('SIMPLETEST'))   define('SIMPLETEST', '/www/simpletest/');
30 if (!defined('INSTALL_PATH')) define('INSTALL_PATH', realpath(dirname(__FILE__) . '/..') . '/' );
31
32 define('TESTS_DIR', dirname(__FILE__) . '/');
684057 33 define('RCMAIL_CONFIG_DIR', TESTS_DIR . 'config');
63d4b1 34
T 35 require_once(SIMPLETEST . 'unit_tester.php');
36 require_once(SIMPLETEST . 'reporter.php');
37 require_once(INSTALL_PATH . 'program/include/iniset.php');
38
39 if (count($_SERVER['argv']) > 1) {
40   $testfiles = array();
41   for ($i=1; $i < count($_SERVER['argv']); $i++)
42     $testfiles[] = realpath('./' . $_SERVER['argv'][$i]);
43 }
44 else {
45   $testfiles = glob(TESTS_DIR . '*.php');
46 }
47
e019f2 48 $test = new TestSuite('Roundcube unit tests');
63d4b1 49 $reporter = new TextReporter();
T 50
51 foreach ($testfiles as $fn) {
52   $test->addTestFile($fn);
53 }
54
55 $test->run($reporter);
56
7fe381 57 ?>