test: add model edge-case tests and a kernel smoke test#80
Merged
Conversation
New unit tests pin behaviors that had no coverage: getTranslation() creating and adding a missing translation (the documented 2.0 write-on-read behavior), hasTranslation(), the addTranslation() guards for null and duplicate locales, removeTranslationWithLocale(), and Accept-Language quality values. New BundleInitializationTest boots a real kernel (FrameworkBundle, DoctrineBundle, ApiPlatformBundle) and asserts the bundle services exist, which finally exercises the translation.groups filter definition that inherits from an api_platform service. It runs against API Platform 3.4/Symfony 6.4 on the lowest CI leg and API Platform 4/ Symfony 8 on the highest. Dependency fixes the new test surfaced: - symfony/yaml was never declared although the extension loads services.yml with YamlFileLoader; it is now a direct requirement. - api-platform/core (with framework-bundle and validator) joins require-dev so tests run the coherent monolith on both majors. The 3.4 split packages resolve to incoherent mixed-patch sets and cannot compile a container, and API Platform 3.4 is incompatible with Symfony 8 (its XML service configs need the removed XmlFileLoader), so realistic 3.4 support means the core package on Symfony <= 7.4.
paullla
added a commit
that referenced
this pull request
Jul 7, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
hasTranslation(),removeTranslationWithLocale(), and theaddTranslation()guards had no test coverage, the write-on-read behavior ofgetTranslation()was never pinned by a test, and nothing anywhere compiled a container, so thetranslation.groupsfilter definition (which inherits from anapi_platformservice definition) and the DI extension were untested against any API Platform version.Changes
hasTranslation(), null/duplicate locale guards,removeTranslationWithLocale()) plus Accept-Language quality-value cases.BundleInitializationTestboots a real kernel (FrameworkBundle, DoctrineBundle, ApiPlatformBundle) and asserts the bundle services exist. Via the existing CI matrix it runs against API Platform 3.4 / Symfony 6.4 on the lowest leg and API Platform 4.3 / Symfony 8.1 on the highest.symfony/yamlis now a direct requirement: the extension loadsservices.ymlthroughYamlFileLoader, but the package was never declared and only ever arrived through consumer apps.api-platform/core,symfony/framework-bundleandsymfony/validatorjoin require-dev so tests run the coherent API Platform monolith on both majors. The 3.4 split packages resolve to incoherent mixed-patch sets that cannot compile a container, and API Platform 3.4 is incompatible with Symfony 8 (its XML service configs rely on the removed DIXmlFileLoader), so realistic 3.4 support means thecorepackage on Symfony 7.4 or lower.Verification
53/53 tests, PHPStan zero errors, php-cs-fixer clean and
composer validate --strictclean, verified on both bounds:--prefer-lowestresolves api-platform/core 3.4.17 + Symfony 6.4.0, highest resolves api-platform/core 4.3.16 + Symfony 8.1.1.