@@ -350,23 +350,7 @@ private function shouldTestBeSkipped(array $sections, array $settings): bool
350
350
$ output = $ this ->runCodeInLocalSandbox ($ skipIfCode );
351
351
}
352
352
353
- if (str_contains ($ output , 'Parse error: ' )) {
354
- EventFacade::emitter ()->testRunnerTriggeredPhpunitWarning (
355
- sprintf (
356
- 'SKIPIF section triggered a parse error: %s ' ,
357
- $ output ,
358
- ),
359
- );
360
- }
361
-
362
- if (str_contains ($ output , 'Fatal error: ' )) {
363
- EventFacade::emitter ()->testRunnerTriggeredPhpunitWarning (
364
- sprintf (
365
- 'SKIPIF section triggered a fatal error: %s ' ,
366
- $ output ,
367
- ),
368
- );
369
- }
353
+ $ this ->triggerRunnerWarningOnPhpErrors ('SKIPIF ' , $ output );
370
354
371
355
if (strncasecmp ('skip ' , ltrim ($ output ), 4 ) === 0 ) {
372
356
$ message = '' ;
@@ -448,19 +432,21 @@ private function runClean(array $sections, bool $collectCoverage): void
448
432
$ cleanCode = (new Renderer )->render ($ this ->filename , $ sections ['CLEAN ' ]);
449
433
450
434
if ($ this ->shouldRunInSubprocess ($ sections , $ cleanCode )) {
451
- $ result = JobRunnerRegistry::run (
435
+ $ jobResult = JobRunnerRegistry::run (
452
436
new Job (
453
437
$ cleanCode ,
454
438
$ this ->settings ($ collectCoverage ),
455
439
),
456
440
);
457
441
458
- EventFacade:: emitter ()-> childProcessFinished ( $ result -> stdout (), $ result -> stderr () );
442
+ $ output = $ jobResult -> stdout ( );
459
443
460
- return ;
444
+ EventFacade::emitter ()->childProcessFinished ($ jobResult ->stdout (), $ jobResult ->stderr ());
445
+ } else {
446
+ $ output = $ this ->runCodeInLocalSandbox ($ cleanCode );
461
447
}
462
448
463
- $ this ->runCodeInLocalSandbox ( $ cleanCode );
449
+ $ this ->triggerRunnerWarningOnPhpErrors ( ' CLEAN ' , $ output );
464
450
}
465
451
466
452
/**
@@ -698,4 +684,27 @@ private function settings(bool $collectCoverage): array
698
684
699
685
return $ settings ;
700
686
}
687
+
688
+ private function triggerRunnerWarningOnPhpErrors (string $ section , string $ output ): void
689
+ {
690
+ if (str_contains ($ output , 'Parse error: ' )) {
691
+ EventFacade::emitter ()->testRunnerTriggeredPhpunitWarning (
692
+ sprintf (
693
+ '%s section triggered a parse error: %s ' ,
694
+ $ section ,
695
+ $ output ,
696
+ ),
697
+ );
698
+ }
699
+
700
+ if (str_contains ($ output , 'Fatal error: ' )) {
701
+ EventFacade::emitter ()->testRunnerTriggeredPhpunitWarning (
702
+ sprintf (
703
+ '%s section triggered a fatal error: %s ' ,
704
+ $ section ,
705
+ $ output ,
706
+ ),
707
+ );
708
+ }
709
+ }
701
710
}
0 commit comments