FOSSology  3.2.0rc1
Open Source License Compliance by Open Source Software
runtemplate.php
1 #!/usr/bin/php
2 <?php
3 /***********************************************************
4  Copyright (C) 2008 Hewlett-Packard Development Company, L.P.
5 
6  This program is free software; you can redistribute it and/or
7  modify it under the terms of the GNU General Public License
8  version 2 as published by the Free Software Foundation.
9 
10  This program is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU General Public License for more details.
14 
15  You should have received a copy of the GNU General Public License along
16  with this program; if not, write to the Free Software Foundation, Inc.,
17  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18  ***********************************************************/
19 
30 $path = '/usr/local/simpletest' . PATH_SEPARATOR;
31 set_include_path(get_include_path() . PATH_SEPARATOR . $path);
32 if (!defined('SIMPLE_TEST'))
33  define('SIMPLE_TEST', '/usr/local/simpletest/');
34 
35 /* simpletest includes */
36 require_once SIMPLE_TEST . 'unit_tester.php';
37 require_once SIMPLE_TEST . 'reporter.php';
38 require_once SIMPLE_TEST . 'web_tester.php';
39 
40 require_once('TestEnvironment.php');
41 // adjust the path below as needed, the path below assumes ..fossology/tests
42 require_once('testClasses/timer.php');
43 
44 /* replace the TestSuite string with one that describes what the test suite is */
45 $start = new timer();
46 print "Starting xxxx Tests at: " . date('r') . "\n";
47 $test = new TestSuite("Run Fossology tests");
48 /*
49  * To run a test use addTestFile method. as many tests as needed can be run this way.
50  * Just keep adding more $test->addTestFile(sometest) lines to this
51  * file for each new test.
52  */
53 $test->addTestFile('atest');
54 /*
55  * edit the print statements as needed, but leave the code below alone,
56  * it allows the tests to be run either by the cli or in a web browser
57  */
58  $elapseTime = $start->TimeAgo($start->getStartTime());
59 
60 if (TextReporter :: inCli())
61 {
62  $results = $test->run(new TextReporter()) ? 0 : 1;
63  print "Ending xxx Tests at: " . date('r') . "\n";
64  print "The xxxx Tests took {$elapseTime}to run\n";
65  exit($results);
66 }
67 $test->run(new HtmlReporter());
68 $elapseTime = $start->TimeAgo($start->getStartTime());
69 print "<pre>The xxxx Tests took {$elapseTime}to run</pre>\n";
70 ?>
Definition: timer.php:42