FOSSology  4.4.0
Open Source License Compliance by Open Source Software
runtemplate.php
1 #!/usr/bin/php
2 <?php
3 /*
4  SPDX-FileCopyrightText: © 2008 Hewlett-Packard Development Company, L.P.
5 
6  SPDX-License-Identifier: GPL-2.0-only
7 */
18 $path = '/usr/local/simpletest' . PATH_SEPARATOR;
19 set_include_path(get_include_path() . PATH_SEPARATOR . $path);
20 if (!defined('SIMPLE_TEST'))
21  define('SIMPLE_TEST', '/usr/local/simpletest/');
22 
23 /* simpletest includes */
24 require_once SIMPLE_TEST . 'unit_tester.php';
25 require_once SIMPLE_TEST . 'reporter.php';
26 require_once SIMPLE_TEST . 'web_tester.php';
27 
28 require_once('TestEnvironment.php');
29 // adjust the path below as needed, the path below assumes ..fossology/tests
30 require_once('testClasses/timer.php');
31 
32 /* replace the TestSuite string with one that describes what the test suite is */
33 $start = new timer();
34 print "Starting xxxx Tests at: " . date('r') . "\n";
35 $test = new TestSuite("Run Fossology tests");
36 /*
37  * To run a test use addTestFile method. as many tests as needed can be run this way.
38  * Just keep adding more $test->addTestFile(sometest) lines to this
39  * file for each new test.
40  */
41 $test->addTestFile('atest');
42 /*
43  * edit the print statements as needed, but leave the code below alone,
44  * it allows the tests to be run either by the cli or in a web browser
45  */
46  $elapseTime = $start->TimeAgo($start->getStartTime());
47 
48 if (TextReporter :: inCli())
49 {
50  $results = $test->run(new TextReporter()) ? 0 : 1;
51  print "Ending xxx Tests at: " . date('r') . "\n";
52  print "The xxxx Tests took {$elapseTime}to run\n";
53  exit($results);
54 }
55 $test->run(new HtmlReporter());
56 $elapseTime = $start->TimeAgo($start->getStartTime());
57 print "<pre>The xxxx Tests took {$elapseTime}to run</pre>\n";
Definition: timer.php:31