1
|
|
|
#!/usr/bin/env php |
2
|
|
|
<?php |
3
|
|
|
/** |
4
|
|
|
* EGroupware Test Runner |
5
|
|
|
* |
6
|
|
|
* @author Ralf Becker <[email protected]> |
7
|
|
|
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License |
8
|
|
|
*/ |
9
|
|
|
|
10
|
|
|
if (php_sapi_name() !== 'cli') // security precaution: forbit calling as web-page |
11
|
|
|
{ |
12
|
|
|
die('<h1>test-cli.php must NOT be called as web-page --> exiting !!!</h1>'); |
13
|
|
|
} |
14
|
|
|
|
15
|
|
|
ini_set('apc.enable_cli', true); |
16
|
|
|
|
17
|
|
|
require_once dirname(__DIR__).'/api/src/loader/common.php'; |
18
|
|
|
|
19
|
|
|
$_SERVER['argv'][] = '--verbose'; |
20
|
|
|
$_SERVER['argv'][] = 'EgroupwareTestRunner'; |
21
|
|
|
$_SERVER['argv'][] = __FILE__; |
22
|
|
|
PHPUnit_TextUI_Command::main(); |
|
|
|
|
23
|
|
|
|
24
|
|
|
/** |
25
|
|
|
* Run all AllTests.php files |
26
|
|
|
*/ |
27
|
|
|
class EgroupwareTestRunner |
28
|
|
|
{ |
29
|
|
|
public static function suite() |
30
|
|
|
{ |
31
|
|
|
$suite = new PHPUnit_Framework_TestSuite('EGroupware Test Runner'); |
|
|
|
|
32
|
|
|
|
33
|
|
|
$basedir = dirname(__DIR__); |
34
|
|
|
|
35
|
|
|
// Find all /test/*Test.php files/classes |
36
|
|
|
foreach (new RecursiveIteratorIterator(new RecursiveDirectoryIterator($basedir)) as $file) |
37
|
|
|
{ |
38
|
|
|
if ($file->isFile() && preg_match('|/test/[^/]+Test\.php$|', $path=$file->getPathname())) |
39
|
|
|
{ |
40
|
|
|
// Include the test suite, as it is NOT autoloadable in test directory! |
41
|
|
|
require_once($path); |
42
|
|
|
|
43
|
|
|
|
44
|
|
|
$matches = null; |
45
|
|
|
// tests of namespaced classes in $app/src/.*/test/$classTest.php |
46
|
|
|
if (preg_match('|/([^/]+)/src/((.*)/)?test/[^/]+Test\.php$|', $path, $matches)) |
47
|
|
|
{ |
48
|
|
|
$class = 'EGroupware\\'.ucfirst($matches[1]); |
49
|
|
|
if (!empty($matches[2])) |
50
|
|
|
{ |
51
|
|
|
foreach(explode('/', $matches[3]) as $name) |
52
|
|
|
{ |
53
|
|
|
$class .= '\\'.ucfirst($name); |
54
|
|
|
} |
55
|
|
|
} |
56
|
|
|
$class .= '\\'.$file->getBasename('.php'); |
57
|
|
|
} |
58
|
|
|
// non-namespaced class in $app/test/class.$classTest.inc.php |
59
|
|
|
elseif (preg_match('|/test/class\.([^./]+)\.inc\.php$|', $path, $matches)) |
60
|
|
|
{ |
61
|
|
|
$class = $matches[1]; |
62
|
|
|
} |
63
|
|
|
else |
64
|
|
|
{ |
65
|
|
|
continue; |
66
|
|
|
} |
67
|
|
|
echo "$path: $class\n"; |
68
|
|
|
$suite->addTestSuite($class); |
69
|
|
|
} |
70
|
|
|
} |
71
|
|
|
return $suite; |
72
|
|
|
} |
73
|
|
|
} |
74
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths