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
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.

1 participant