@@ -300,4 +300,41 @@ public function testItRegistersMetadataConfiguration(): void
300300 $ this ->assertContainerHasService ('api_platform.metadata.resource_extractor.php_file ' );
301301 $ this ->assertSame ([$ emptyPhpFile ], $ this ->container ->getDefinition ('api_platform.metadata.resource_extractor.php_file ' )->getArgument (0 ));
302302 }
303+
304+ public function testPaginationMaximumItemsPerPageIsNotSet (): void
305+ {
306+ $ config = self ::DEFAULT_CONFIG ;
307+ (new ApiPlatformExtension ())->load ($ config , $ this ->container );
308+
309+ $ this ->assertTrue ($ this ->container ->hasParameter ('api_platform.collection.pagination.maximum_items_per_page ' ));
310+ $ this ->assertSame (30 , $ this ->container ->getParameter ('api_platform.collection.pagination.maximum_items_per_page ' ));
311+ }
312+
313+ public function testPaginationMaximumItemsPerPageIsSetWithNull (): void
314+ {
315+ $ config = self ::DEFAULT_CONFIG ;
316+ $ config ['api_platform ' ]['defaults ' ]['pagination_maximum_items_per_page ' ] = null ;
317+ (new ApiPlatformExtension ())->load ($ config , $ this ->container );
318+
319+ $ this ->assertTrue ($ this ->container ->hasParameter ('api_platform.collection.pagination.maximum_items_per_page ' ));
320+ $ this ->assertNull ($ this ->container ->getParameter ('api_platform.collection.pagination.maximum_items_per_page ' ));
321+ }
322+
323+ public function testPaginationMaximumItemsPerPageIsSetWithExplicitValue (): void
324+ {
325+ $ config = self ::DEFAULT_CONFIG ;
326+ $ config ['api_platform ' ]['defaults ' ]['pagination_maximum_items_per_page ' ] = 22 ;
327+ (new ApiPlatformExtension ())->load ($ config , $ this ->container );
328+
329+ $ this ->assertSame (22 , $ this ->container ->getParameter ('api_platform.collection.pagination.maximum_items_per_page ' ));
330+ }
331+
332+ public function testPaginationMaximumItemsPerPageIsSetWithZero (): void
333+ {
334+ $ config = self ::DEFAULT_CONFIG ;
335+ $ config ['api_platform ' ]['defaults ' ]['pagination_maximum_items_per_page ' ] = 0 ;
336+ (new ApiPlatformExtension ())->load ($ config , $ this ->container );
337+
338+ $ this ->assertSame (0 , $ this ->container ->getParameter ('api_platform.collection.pagination.maximum_items_per_page ' ));
339+ }
303340}
0 commit comments