test(doctrine): adapt unwired filter test to 5.0 - #8501
Merged
Merged
Conversation
The test came up from 4.4, where DateFilter extends AbstractFilter and its getDescription() throws when no ManagerRegistry was injected, so ParameterResourceMetadataCollectionFactory catches it and downgrades the log to debug. On 5.0 DateFilter is standalone and getClassMetadata() falls back to a bare ClassMetadata instead of throwing, so the catch never runs and nothing is logged at all -- which still satisfies api-platform#7361.
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
UnwiredLegacyFilterParameterTest::testUnwiredRegistryAwareFilterIsLoggedAtDebugis red onmain(all linkedapi-platform/doctrine-ormPHPUnit jobs):Cause
The test arrived on
mainvia the 4.4 up-merge and encodes 4.4-specific behaviour.On 4.4,
DateFilter extends AbstractFilter, whosegetDescription()throws aRuntimeExceptionwhen noManagerRegistrywas injected.ParameterResourceMetadataCollectionFactorycatches it and logs atdebugrather thanalertfor an unwiredManagerRegistryAwareInterfacefilter (#8490, closes #7361).On 5.0,
DateFilteris a standalone filter (#8351): it implementsManagerRegistryAwareInterfacedirectly, andgetClassMetadata()falls back tonew ClassMetadata($resourceClass)whenhasManagerRegistry()is false. It never throws, sogetLegacyFilterMetadata()succeeds, thecatchblock is never entered, and neitherdebugnoralertis called.That 5.0 behaviour is correct and still satisfies #7361 — it avoids the warmup noise by not failing at all, rather than by downgrading the log level.
Change
Test-only. The first case now asserts the actual 5.0 contract (nothing is logged) and is renamed accordingly.
testFilterFailureUnrelatedToTheManagerRegistryStillAlertsis untouched and still pins the alert path for an unrelated filter failure.No production code changed.