Skip to content

Commit

Permalink
Merge branch '0.26'
Browse files Browse the repository at this point in the history
  • Loading branch information
maks-rafalko committed Jan 20, 2022
2 parents 8042277 + c4c7390 commit 4e21783
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
3 changes: 3 additions & 0 deletions src/Logger/Html/StrykerHtmlReportBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,9 @@ private function getFiles(): ArrayObject

if ($this->metricsCalculator->getTotalMutantsCount() !== 0) {
$resultsByPath = $this->retrieveResultsByPath();

Assert::minCount($resultsByPath, 1, 'There must be at least one result to build HTML report.');

$basePath = Path::getLongestCommonBasePath(array_keys($resultsByPath));

Assert::string($basePath, '$basePath must be a string');
Expand Down
6 changes: 2 additions & 4 deletions src/Mutation/FileMutationGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,14 +78,12 @@ public function generate(
return;
}

$fileInfo = $trace->getSourceFileInfo();

$initialStatements = $this->parser->parse($fileInfo);
$initialStatements = $this->parser->parse($trace->getSourceFileInfo());

$mutationCollectorVisitor = new MutationCollectorVisitor(
new NodeMutationGenerator(
$mutators,
$fileInfo->getPathname(),
$trace->getRealPath(),
$initialStatements,
$trace,
$onlyCovered,
Expand Down
5 changes: 5 additions & 0 deletions tests/phpunit/Mutation/FileMutationGeneratorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,11 @@ public function test_it_generates_mutations_for_a_given_file(): void
->method('getAllTestsForMutation')
->willReturn([])
;
$traceMock
->expects($this->once())
->method('getRealPath')
->willReturn(self::FIXTURES_DIR . '/Mutation/OneFile/OneFile.php')
;

$mutationGenerator = SingletonContainer::getContainer()->getFileMutationGenerator();

Expand Down

0 comments on commit 4e21783

Please sign in to comment.