alecpl
2011-02-25 b649c49e64a487ac8ad347aed42336dec2e74cd7
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                            |
63d4b1 10  | Licensed under the GNU GPL                                            |
T 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
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
54 ?>