Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test coverage 100% #197

Merged
merged 1 commit into from
Sep 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions tests/Paginator/KeysetPaginatorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,15 @@ public function testDataReaderWithoutSortableInterface(): void
new KeysetPaginator($this->getNonSortableDataReader());
}

public function testDataReaderWithLimit(): void
{
$dataReader = (new IterableDataReader([]))->withLimit(1);

$this->expectException(InvalidArgumentException::class);
$this->expectExceptionMessage('Limited data readers are not supported by keyset pagination.');
new KeysetPaginator($dataReader);
}

public function testDataReaderWithoutLimitableInterface(): void
{
$dataReader = new class () implements ReadableDataInterface, SortableDataInterface, FilterableDataInterface {
Expand Down
21 changes: 13 additions & 8 deletions tests/Reader/Iterable/IterableDataReaderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -121,11 +121,15 @@ public function testOffsetIsApplied(): void
$data = $reader->read();

$this->assertCount(3, $data);
$this->assertSame([
2 => self::ITEM_3,
3 => self::ITEM_4,
4 => self::ITEM_5,
], $data);
$this->assertSame(
[
2 => self::ITEM_3,
3 => self::ITEM_4,
4 => self::ITEM_5,
],
$data
);
$this->assertSame(2, $reader->getOffset());
}

public function testAscSorting(): void
Expand Down Expand Up @@ -396,14 +400,15 @@ public function testGeneratorAsDataSet(): void

public function testCustomFilter(): void
{
$filter = new All(new GreaterThan('id', 0), new Digital('name'));
$reader = (new IterableDataReader(self::DEFAULT_DATASET))
->withAddedFilterHandlers(new DigitalHandler())
->withFilter(
new All(new GreaterThan('id', 0), new Digital('name'))
);
->withFilter($filter);

$filtered = $reader->read();

$this->assertSame([4 => self::ITEM_5], $filtered);
$this->assertSame($filter, $reader->getFilter());
}

public function testCustomEqualsProcessor(): void
Expand Down
Loading