Skip to content

Commit

Permalink
Eliminate mutants
Browse files Browse the repository at this point in the history
  • Loading branch information
samdark committed Oct 18, 2024
1 parent 7d2334e commit 84dc464
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
5 changes: 3 additions & 2 deletions tests/Paginator/OffsetPaginatorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -529,8 +529,9 @@ public function testImmutability(): void
public static function dataIsSupportSorting(): array
{
return [
[true, new IterableDataReader([])],
[false, new StubOffsetData()],
'IterableDataReader' => [true, new IterableDataReader([])],
'StubOffsetData' => [false, new StubOffsetData()],
'StubOffsetDataWithLimit' => [false, (new StubOffsetData())->withLimit(10)],
];
}

Expand Down
12 changes: 10 additions & 2 deletions tests/Support/StubOffsetData.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@ final class StubOffsetData implements
CountableDataInterface,
LimitableDataInterface
{
/**
* @var int|null
* @psalm-var non-negative-int
*/
private ?int $limit = null;

public function read(): iterable
{
return [];
Expand All @@ -32,7 +38,9 @@ public function count(): int

public function withLimit(?int $limit): static
{
return $this;
$new = clone $this;
$new->limit = $limit;
return $new;
}

public function withOffset(int $offset): static
Expand All @@ -42,7 +50,7 @@ public function withOffset(int $offset): static

public function getLimit(): ?int
{
return 0;
return $this->limit;
}

public function getOffset(): int
Expand Down

0 comments on commit 84dc464

Please sign in to comment.