Skip to content

Commit edd7299

Browse files
committed
bug(pagination): update tests to use MappedObjectPaginator instead of ArrayPaginator
1 parent 054b597 commit edd7299

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

src/State/Pagination/MappedObjectPaginator.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@ public function __construct(
2424
private readonly float $currentPage = 1.0,
2525
private readonly float $lastPage = 1.0,
2626
private readonly float $itemsPerPage = 30.0,
27-
) {}
27+
) {
28+
}
2829

2930
public function count(): int
3031
{

tests/State/Provider/ObjectMapperProviderTest.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515

1616
use ApiPlatform\Metadata\Get;
1717
use ApiPlatform\State\Pagination\ArrayPaginator;
18+
use ApiPlatform\State\Pagination\MappedObjectPaginator;
1819
use ApiPlatform\State\Provider\ObjectMapperProvider;
1920
use ApiPlatform\State\ProviderInterface;
2021
use PHPUnit\Framework\TestCase;
@@ -160,7 +161,7 @@ public function testProvideMapsPaginator(): void
160161
$provider = new ObjectMapperProvider($objectMapper, $decorated);
161162

162163
$result = $provider->provide($operation);
163-
$this->assertInstanceOf(ArrayPaginator::class, $result);
164+
$this->assertInstanceOf(MappedObjectPaginator::class, $result);
164165
$items = iterator_to_array($result);
165166
$this->assertCount(2, $items);
166167
$this->assertSame($targetResource1, $items[0]);
@@ -192,7 +193,7 @@ public function testProvideMapsEmptyPaginator(): void
192193
$provider = new ObjectMapperProvider($objectMapper, $decorated);
193194

194195
$result = $provider->provide($operation);
195-
$this->assertInstanceOf(ArrayPaginator::class, $result);
196+
$this->assertInstanceOf(MappedObjectPaginator::class, $result);
196197
$this->assertCount(0, iterator_to_array($result));
197198
}
198199
}

0 commit comments

Comments
 (0)