Skip to content

Commit

Permalink
Testdox: fix summary report previously not shown (#772)
Browse files Browse the repository at this point in the history
  • Loading branch information
Slamdunk committed Jun 22, 2023
1 parent 970d21c commit 14ab034
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 27 deletions.
46 changes: 21 additions & 25 deletions src/WrapperRunner/ResultPrinter.php
Original file line number Diff line number Diff line change
Expand Up @@ -192,37 +192,33 @@ public function printResults(TestResult $testResult, array $teamcityFiles, array
return;
}

$this->printer->print(PHP_EOL . (new ResourceUsageFormatter())->resourceUsageSinceStartOfRequest() . PHP_EOL . PHP_EOL);

if ($this->options->configuration->outputIsTestDox()) {
$this->output->write($this->tailMultiple($testdoxFiles));

return;
} else {
(new DefaultResultPrinter(
$this->printer,
true,
true,
true,
true,
true,
true,
$this->options->configuration->displayDetailsOnIncompleteTests(),
$this->options->configuration->displayDetailsOnSkippedTests(),
$this->options->configuration->displayDetailsOnTestsThatTriggerDeprecations(),
$this->options->configuration->displayDetailsOnTestsThatTriggerErrors(),
$this->options->configuration->displayDetailsOnTestsThatTriggerNotices(),
$this->options->configuration->displayDetailsOnTestsThatTriggerWarnings(),
false,
))->print($testResult);
}

$resultPrinter = new DefaultResultPrinter(
$this->printer,
true,
true,
true,
true,
true,
true,
$this->options->configuration->displayDetailsOnIncompleteTests(),
$this->options->configuration->displayDetailsOnSkippedTests(),
$this->options->configuration->displayDetailsOnTestsThatTriggerDeprecations(),
$this->options->configuration->displayDetailsOnTestsThatTriggerErrors(),
$this->options->configuration->displayDetailsOnTestsThatTriggerNotices(),
$this->options->configuration->displayDetailsOnTestsThatTriggerWarnings(),
false,
);
$summaryPrinter = new SummaryPrinter(
(new SummaryPrinter(
$this->printer,
$this->options->configuration->colors(),
);

$this->printer->print(PHP_EOL . (new ResourceUsageFormatter())->resourceUsageSinceStartOfRequest() . PHP_EOL . PHP_EOL);

$resultPrinter->print($testResult);
$summaryPrinter->print($testResult);
))->print($testResult);
}

private function printFeedbackItem(string $item): void
Expand Down
10 changes: 8 additions & 2 deletions test/Unit/WrapperRunner/ResultPrinterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,10 @@ public function testTestdoxOutputWithProgress(): void
$this->printer->printFeedback(new SplFileInfo($feedbackFile), new SplFileInfo($outputFile), []);
$this->printer->printResults($this->getEmptyTestResult(), [], [new SplFileInfo($testdoxSource)]);

self::assertSame('EEE' . $testdoxSourceContent, $this->output->fetch());
self::assertStringMatchesFormat(
'EEE' . "\n" . 'Time: %a, Memory: %a' . "\n\n" . $testdoxSourceContent . 'No tests executed!',
$this->output->fetch(),
);
}

public function testTestdoxOutputWithoutProgress(): void
Expand All @@ -252,7 +255,10 @@ public function testTestdoxOutputWithoutProgress(): void
$this->printer->printFeedback(new SplFileInfo($feedbackFile), new SplFileInfo($outputFile), []);
$this->printer->printResults($this->getEmptyTestResult(), [], [new SplFileInfo($testdoxSource)]);

self::assertSame($testdoxSourceContent, $this->output->fetch());
self::assertStringMatchesFormat(
"\n" . 'Time: %a, Memory: %a' . "\n\n" . $testdoxSourceContent . 'No tests executed!',
$this->output->fetch(),
);
}

public function testPrintFeedbackFromMultilineSource(): void
Expand Down

0 comments on commit 14ab034

Please sign in to comment.