Skip to content

Commit 0273d23

Browse files
committed
Merge 3.3
2 parents 587f33b + 1b9dfcc commit 0273d23

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

src/State/Pagination/TraversablePaginator.php

+4
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,10 @@ public function count(): int
6868
return (int) ceil($this->totalItems);
6969
}
7070

71+
if ($this->totalItems === $this->itemsPerPage) {
72+
return (int) ceil($this->totalItems);
73+
}
74+
7175
return $this->totalItems % $this->itemsPerPage;
7276
}
7377

tests/State/Pagination/TraversablePaginatorTest.php

+7-5
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,13 @@ public function testInitialize(
4747
public static function initializeProvider(): array
4848
{
4949
return [
50-
'First of three pages of 3 items each' => [[0, 1, 2, 3, 4, 5, 6], 1, 3, 7, 3, 3, true],
51-
'Second of two pages of 3 items for the first page and 2 for the second' => [[0, 1, 2, 3, 4], 2, 3, 5, 2, 2, false],
52-
'Empty results' => [[], 1, 2, 0, 1, 0, false],
53-
'0 items per page' => [[0, 1, 2, 3], 1, 0, 4, 1, 4, false],
54-
'Total items less than items per page' => [[0, 1, 2], 1, 4, 3, 1, 3, false],
50+
'First of three pages of 3 items each' => [[0, 1, 2, 3, 4, 5, 6], 1, 3, 7, 3, 3],
51+
'Second of two pages of 3 items for the first page and 2 for the second' => [[0, 1, 2, 3, 4], 2, 3, 5, 2, 2],
52+
'Empty results' => [[], 1, 2, 0, 1, 0],
53+
'0 items per page' => [[0, 1, 2, 3], 1, 0, 4, 1, 4],
54+
'Total items less than items per page' => [[0, 1, 2], 1, 4, 3, 1, 3],
55+
'Only one result' => [[0], 1, 1, 1, 1, 1],
56+
'Same result number than total page' => [[0, 2, 3], 1, 3, 3, 1, 3],
5557
];
5658
}
5759
}

0 commit comments

Comments
 (0)