-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
IBX-8957: Fixed deserializing SiteAccess Matchers for ESI #430
IBX-8957: Fixed deserializing SiteAccess Matchers for ESI #430
Conversation
7eb0ce3
to
e784f1b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should cover this scenario within tests/lib/MVC/Symfony/EventListener/SiteAccessMatchListenerTest
.
This needs to be tested with a matcher which is in the siteAccessMatcherRegistry, but I don't think any of the build-in matchers are there.. ( the fix is inside the So, then I would need to make a new test inside SiteFactory based on |
@vidarl
I just wanted to have it covered as it seems the shape of the object changes substantially. If the test boils down to tons of mocking and only checking if |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks okay-ish but I would like to see the test covering this scenario but this is kind hard to deliver after internal sync. Maybe @alongosz has some tips on how to test that so it brings any value (without mocking tons of classes).
b250d10
to
a316206
Compare
I have written a test now.
SonarCloud fails due to duplication code in the test. I asssume this is OK ? |
SonarCloud is happy too now.... |
a7386e0
to
472ec69
Compare
tests/lib/MVC/Symfony/EventListener/SiteAccessMatchListenerTest.php
Outdated
Show resolved
Hide resolved
tests/lib/MVC/Symfony/EventListener/SiteAccessMatchListenerTest.php
Outdated
Show resolved
Hide resolved
tests/lib/MVC/Symfony/EventListener/SiteAccessMatchListenerTest.php
Outdated
Show resolved
Hide resolved
85ed742
to
9ce8dea
Compare
9ce8dea
to
606af76
Compare
606af76
to
4f5bdf8
Compare
src/lib/MVC/Symfony/Component/Serializer/CompoundMatcherNormalizer.php
Outdated
Show resolved
Hide resolved
Co-Authored-By: Paweł Niedzielski <Steveb-p@users.noreply.github.com>
a25473f
to
1270e47
Compare
Co-Authored-By: Paweł Niedzielski <Steveb-p@users.noreply.github.com>
Quality Gate passedIssues Measures |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reproduced and retested.
Sanities with matchers OK.
Description:
When unserializing SiteaccessMatcher in ESI, custom matchers was only fetch from registry. Serialized configuration of the matcher was not restored.
In case of sitefactoy's SiteAccessMatcher, it meant that mapKey was never restored, causing incorrect links to be generated.
(Map is an ancestor of SiteAccessMatcher)
Maintainer update: this issue uncovered a few other underlying issues. We were using traits in production code to configure serializers. Instead I've (@alongosz) changed it to configured
ibexa.core.mvc.serializer
service.Moreover the same mirrored code was used to serialize and deserialize data and store them into 3 separate request attributes. While the latter case needs to be tackled separately via IBX-9102, I've made the code uniformly use the same serializer for both serialization and deserialization of data. The
SerializerTrait
is left only for unit test purposes.I've introduced
...\Fragment\SiteAccessSerializer
service to wrap whatSiteAccessSerializationTrait
was doing for production code.The end goal is to have serialization/deserialization handled by configured Symfony serializers entirely. The question now is if we should move parts of the scope resolved here to IBX-9102, or should we keep this and only improve in IBX-9102?
For QA:
See ticket for instructions on how to reproduce.
Maintainer update: sanities on SiteAccess matchers, including compound matchers are needed.
Regression run: 🟢 ibexa/commerce#1081
Matchers tests: 🟢 ibexa/experience#500
Documentation: