Skip to content

Conversation

@Maxcastel
Copy link
Contributor

@Maxcastel Maxcastel commented Dec 15, 2025

Q A
Branch? 4.2
Tickets Closes #..., closes #...
License MIT
Doc PR api-platform/docs#...

This PR adds a unit test to the ApiPlatformExtensionTest to ensure that the pagination_maximum_items_per_page parameter is correctly set to its default value when the defaults configuration key is absent from the configuration.

Commit 2aa0eb1 introduced an array access safeguard ($config['defaults'] ?? []) in ApiPlatformExtension.php to prevent the Warning: Undefined array key "defaults" error reported in PR #7567 when attempting to read the configuration option pagination_maximum_items_per_page.

The error was fixed, but no test was added to verify the non-regression (if someone removes the array safeguard (?? []), the tests still pass).

This test unsets the defaults key from the configuration array before loading the extension, ensuring that the fallback mechanism works as expected and that the default value for pagination_maximum_items_per_page (30) is correctly applied.

@Maxcastel Maxcastel force-pushed the test-config-missing-defaults-key branch from b6e6f6d to fb75479 Compare December 15, 2025 12:23
@Maxcastel Maxcastel force-pushed the test-config-missing-defaults-key branch from fb75479 to 71b57d2 Compare December 30, 2025 14:00
@Maxcastel Maxcastel marked this pull request as ready for review December 30, 2025 14:16
@Maxcastel Maxcastel changed the title test(symfony): ensure pagination_maximum_items_per_page defaults correctly when config defaults key is absent test(symfony): ensure pagination_maximum_items_per_page defaults correctly when config defaults key is absent Dec 30, 2025
@soyuka soyuka merged commit 0e899fa into api-platform:4.2 Dec 31, 2025
129 of 130 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants