forked from cybermonde/odtphp
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathphpunit-runner.php
More file actions
executable file
·36 lines (29 loc) · 1012 Bytes
/
phpunit-runner.php
File metadata and controls
executable file
·36 lines (29 loc) · 1012 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
<?php
use PHPUnit\TextUI\Configuration\Configuration;
use PHPUnit\TextUI\TestRunner;
require_once 'vendor/autoload.php';
// Custom error handler to suppress specific warnings
set_error_handler(function($errno, $errstr, $errfile, $errline) {
// List of patterns to ignore
$ignoredPatterns = [
'/Class .* does not extend PHPUnit\\\\Framework\\\\TestCase/',
'/Class .* cannot be found/',
'/vendor\/phpunit/',
'/vendor\/scrutinizer/',
'/vendor\/symfony/'
];
foreach ($ignoredPatterns as $pattern) {
if (preg_match($pattern, $errstr)) {
return true; // Suppress the warning
}
}
// For other errors, use the default error handler
return false;
});
// Run PHPUnit
$arguments = $_SERVER['argv'];
array_shift($arguments); // Remove script name
$configuration = (new Configuration())->load($arguments);
$testRunner = new TestRunner();
$result = $testRunner->run($configuration);
exit($result->wasSuccessful() ? 0 : 1);