-
-
Notifications
You must be signed in to change notification settings - Fork 28
Expand file tree
/
Copy pathphpunit-patch.php
More file actions
34 lines (30 loc) · 1009 Bytes
/
phpunit-patch.php
File metadata and controls
34 lines (30 loc) · 1009 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
<?php
declare(strict_types=1);
/**
* This file is part of friendsofhyperf/components.
*
* @link https://github.com/friendsofhyperf/components
* @document https://github.com/friendsofhyperf/components/blob/main/README.md
* @contact huangdijia@gmail.com
*/
(function () {
/** @var null|\Composer\Autoload\ClassLoader $classLoader */
$classLoader = null;
foreach (spl_autoload_functions() as $loader) {
if (is_array($loader) && $loader[0] instanceof Composer\Autoload\ClassLoader) {
$classLoader = $loader[0];
break;
}
}
if (! $classLoader) {
return;
}
if ($file = $classLoader->findFile(PHPUnit\Framework\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);
}
}
})();