File tree 1 file changed +31
-0
lines changed
1 file changed +31
-0
lines changed Original file line number Diff line number Diff line change 13
13
use const PHP_VERSION ;
14
14
use function assert ;
15
15
use function class_exists ;
16
+ use function defined ;
17
+ use function dirname ;
16
18
use function explode ;
17
19
use function function_exists ;
18
20
use function is_file ;
22
24
use function realpath ;
23
25
use function sprintf ;
24
26
use function str_contains ;
27
+ use function str_starts_with ;
25
28
use function trim ;
26
29
use function unlink ;
27
30
use PHPUnit \Event \EventFacadeIsSealedException ;
100
103
*/
101
104
public function run (array $ argv ): int
102
105
{
106
+ $ this ->preload ();
107
+
103
108
try {
104
109
EventFacade::emitter ()->applicationStarted ();
105
110
@@ -841,4 +846,30 @@ private function configureDeprecationTriggers(Configuration $configuration): voi
841
846
842
847
ErrorHandler::instance ()->useDeprecationTriggers ($ deprecationTriggers );
843
848
}
849
+
850
+ private function preload (): void
851
+ {
852
+ if (!defined ('PHPUNIT_COMPOSER_INSTALL ' )) {
853
+ return ;
854
+ }
855
+
856
+ $ classMapFile = dirname (PHPUNIT_COMPOSER_INSTALL ) . '/composer/autoload_classmap.php ' ;
857
+
858
+ if (!is_file ($ classMapFile )) {
859
+ return ;
860
+ }
861
+
862
+ foreach (require $ classMapFile as $ codeUnitName => $ sourceCodeFile ) {
863
+ if (!str_starts_with ($ codeUnitName , 'PHPUnit \\' ) &&
864
+ !str_starts_with ($ codeUnitName , 'SebastianBergmann \\' )) {
865
+ continue ;
866
+ }
867
+
868
+ if (str_contains ($ sourceCodeFile , '/tests/ ' )) {
869
+ continue ;
870
+ }
871
+
872
+ require_once $ sourceCodeFile ;
873
+ }
874
+ }
844
875
}
You can’t perform that action at this time.
0 commit comments