Skip to content

test: add model edge-case tests and a kernel smoke test#80

Merged
paullla merged 1 commit into
Locastic:masterfrom
paullla:test/edge-cases-and-kernel
Jul 6, 2026
Merged

test: add model edge-case tests and a kernel smoke test#80
paullla merged 1 commit into
Locastic:masterfrom
paullla:test/edge-cases-and-kernel

Conversation

@paullla

@paullla paullla commented Jul 6, 2026

Copy link
Copy Markdown
Member
Q A
Bug fix? no
New feature? no
BC breaks? no
Deprecations? no
Issues -
License MIT

Problem

hasTranslation(), removeTranslationWithLocale(), and the addTranslation() guards had no test coverage, the write-on-read behavior of getTranslation() was never pinned by a test, and nothing anywhere compiled a container, so the translation.groups filter definition (which inherits from an api_platform service definition) and the DI extension were untested against any API Platform version.

Changes

  • Six new unit tests on the Model layer (missing-translation creation, hasTranslation(), null/duplicate locale guards, removeTranslationWithLocale()) plus Accept-Language quality-value cases.
  • New BundleInitializationTest boots 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/yaml is now a direct requirement: the extension loads services.yml through YamlFileLoader, but the package was never declared and only ever arrived through consumer apps.
  • api-platform/core, symfony/framework-bundle and symfony/validator join 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 DI XmlFileLoader), so realistic 3.4 support means the core package on Symfony 7.4 or lower.

Verification

53/53 tests, PHPStan zero errors, php-cs-fixer clean and composer validate --strict clean, verified on both bounds: --prefer-lowest resolves api-platform/core 3.4.17 + Symfony 6.4.0, highest resolves api-platform/core 4.3.16 + Symfony 8.1.1.

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 paullla merged commit e071ef7 into Locastic:master Jul 6, 2026
6 checks passed
paullla added a commit that referenced this pull request Jul 7, 2026
Rename the Unreleased section to 2.0.0, add the missing entries for the
community files (#79), the edge-case and kernel tests (#80) and the
misconfigured-PUT guard (#81), and add Keep a Changelog compare links.
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