alecpl
2010-06-10 93e3ae138586c3c0a8a02b09abbc3d660e7d31fa
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__) . '/');
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
45 $test = new TestSuite('RoundCube unit tests');
46 $reporter = new TextReporter();
47
48 foreach ($testfiles as $fn) {
49   $test->addTestFile($fn);
50 }
51
52 $test->run($reporter);
53
54 ?>