Add unit testing infrastructure, again straignt from phalanx
[hoplite.git] / testing / test_runner.php
1 <?php
2 // Hoplite
3 // Copyright (c) 2011 Blue Static
4 //
5 // This program is free software: you can redistribute it and/or modify it
6 // under the terms of the GNU General Public License as published by the Free
7 // Software Foundation, either version 3 of the License, or any later version.
8 //
9 // This program is distributed in the hope that it will be useful, but WITHOUT
10 // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 // FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 // more details.
13 //
14 // You should have received a copy of the GNU General Public License along with
15 // this program. If not, see <http://www.gnu.org/licenses/>.
16
17 namespace hoplite\test;
18
19 if (!defined('HOPLITE_ROOT')) {
20 define('HOPLITE_ROOT', dirname(dirname(__FILE__)));
21 define('TEST_ROOT', dirname(__FILE__));
22 }
23
24 // PHPUnit 3.5.5.
25 require_once 'PHPUnit/Autoload.php';
26 require_once TEST_ROOT . '/test_listener.php';
27
28 class HopliteTestRunner extends \PHPUnit_TextUI_Command
29 {
30 static public function Main($exit = TRUE)
31 {
32 $command = new self();
33 $command->Run($_SERVER['argv'], $exit);
34 }
35
36 protected function HandleCustomTestSuite()
37 {
38 $this->arguments['printer'] = new TestListener();
39 }
40 }
41
42 HopliteTestRunner::Main();