Skip to content

Commit

Permalink
ProxyTrace should check for tests locations (#1494)
Browse files Browse the repository at this point in the history
Fixes #1480
  • Loading branch information
sanmai authored and maks-rafalko committed Mar 1, 2021
1 parent 37e9682 commit b4f036a
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/TestFramework/Coverage/ProxyTrace.php
Expand Up @@ -108,6 +108,10 @@ public function getTests(): ?TestLocations

public function getAllTestsForMutation(NodeLineRangeData $lineRange, bool $isOnFunctionSignature): iterable
{
if ($this->lazyTestLocations === null) {
return [];
}

return $this->getTestLocator()->getAllTestsForMutation($lineRange, $isOnFunctionSignature);
}

Expand Down
9 changes: 9 additions & 0 deletions tests/phpunit/TestFramework/Coverage/ProxyTraceTest.php
Expand Up @@ -109,6 +109,15 @@ public function test_it_returns_null_for_no_tests(): void
$this->assertNull($trace->getTests());
}

public function test_it_returns_empty_iterable_for_no_tests(): void
{
$fileInfoMock = $this->createMock(SplFileInfo::class);

$trace = new ProxyTrace($fileInfoMock, null);

$this->assertCount(0, $trace->getAllTestsForMutation(new NodeLineRangeData(1, 2), false));
}

public function test_it_exposes_its_test_locations(): void
{
$fileInfoMock = $this->createMock(SplFileInfo::class);
Expand Down

0 comments on commit b4f036a

Please sign in to comment.