Skip to content

Commit ba17ca7

Browse files
staabmsebastianbergmann
authored andcommitted
Made method re-usable for different sections
1 parent e724f7a commit ba17ca7

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/Runner/Phpt/TestCase.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,7 @@ private function shouldTestBeSkipped(array $sections, array $settings): bool
350350
$output = $this->runCodeInLocalSandbox($skipIfCode);
351351
}
352352

353-
$this->triggerWarningOnPhpErrors($output);
353+
$this->triggerWarningOnPhpErrors('SKIPIF', $output);
354354

355355
if (strncasecmp('skip', ltrim($output), 4) === 0) {
356356
$message = '';
@@ -683,12 +683,13 @@ private function settings(bool $collectCoverage): array
683683
return $settings;
684684
}
685685

686-
private function triggerWarningOnPhpErrors(string $output): void
686+
private function triggerWarningOnPhpErrors(string $section, string $output): void
687687
{
688688
if (str_contains($output, 'Parse error:')) {
689689
EventFacade::emitter()->testRunnerTriggeredPhpunitWarning(
690690
sprintf(
691-
'SKIPIF section triggered a parse error: %s',
691+
'%s section triggered a parse error: %s',
692+
$section,
692693
$output,
693694
),
694695
);
@@ -697,7 +698,8 @@ private function triggerWarningOnPhpErrors(string $output): void
697698
if (str_contains($output, 'Fatal error:')) {
698699
EventFacade::emitter()->testRunnerTriggeredPhpunitWarning(
699700
sprintf(
700-
'SKIPIF section triggered a fatal error: %s',
701+
'%s section triggered a fatal error: %s',
702+
$section,
701703
$output,
702704
),
703705
);

0 commit comments

Comments
 (0)