-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathphpunit-patch.php
More file actions
35 lines (33 loc) · 990 Bytes
/
phpunit-patch.php
File metadata and controls
35 lines (33 loc) · 990 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
<?php
declare(strict_types=1);
/**
* This file is part of Hyperf.
*
* @link https://www.hyperf.io
* @document https://hyperf.wiki
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/
use Composer\Autoload\ClassLoader;
use PHPUnit\Framework\TestCase;
(function () {
/** @var null|ClassLoader $classLoader */
$classLoader = null;
foreach (spl_autoload_functions() as $loader) {
if (is_array($loader) && $loader[0] instanceof ClassLoader) {
$classLoader = $loader[0];
break;
}
}
if (! $classLoader) {
return;
}
if ($file = $classLoader->findFile(TestCase::class)) {
$content = file_get_contents($file);
$replace = 'public function runBare';
if (strpos($content, $find = 'final ' . $replace) !== false) {
$content = str_replace($find, $replace, $content);
file_put_contents($file, $content);
}
}
})();