-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[JsonPath] Test against official compliance test suite #60695
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
base: 7.3
Are you sure you want to change the base?
[JsonPath] Test against official compliance test suite #60695
Conversation
This is my first "proper" contribution to Symfony.
|
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.
We should record the info about which commit/release of the CTS we vendor, with a script we can run to fetch the latest version, updating both cts.json and the version.
Otherwise, it will be hard to manage updates when the compliance testsuite adds new tests to increase coverage (which might happen)
@stof As this is only one JSON file that can be also be downloaded manually without any issue, I assumed that providing the exact hash based link, see https://github.com/symfony/symfony/pull/60695/files#diff-8312c65e1b644a04bd87f0dee0894ab6712b296af12a1e191d1faaf5a1f52784R37, was sufficient. PS: Are you talking about a similar approach to the one the Intl component uses? |
$this->expectException(JsonCrawlerException::class); | ||
} | ||
|
||
$result = (new JsonCrawler(json_encode($document)))->find($selector); |
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 suggest separating the JsonCrawler instantiation from the find
call, so that invalid selectors don't allow us to expect an exception in the instantiation part. This would be done by making the call $this->expectException(JsonCrawlerException::class);
after instantiation but before running the selector.
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.
Done.
I think we might need a constant in the test containing a list of test names we don't support yet, for which the test would get skipped in CI (maybe with an env variable to force running them when working on them locally). |
e962cd0
to
e088cc3
Compare
this comment in a separate location is almost guaranteed to become outdated by being forgotten when updating the JSON file.
the fetching is indeed a lot simpler, as we just save the file as is without any processing. See for instance https://github.com/symfony/symfony/tree/7.4/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Script/Mermaid where we have a Makefile fetching a specific reference of Mermaid (it is not a simple download of the file there, as we do a custom build). Updating to a new version involves updating the version number in the Makefile and then running |
@stof I added a makefile and added a const to exclude unsupported files.
Not sure about this part (also not done) because it can basically also be done by temporarily commenting out/removing the array contents similar to
|
It makes me think of something: if a feature is lacking to make the suite pass, should this be considered a bugfix and target 7.3 or should we target 7.4? |
As we are currently merging them as bugfix in 7.3 (as the component is announced as implementing the RFC, not as implementing its own syntax inspired by JsonPath), I suggest merging this PR in 7.3, so that we can clean the skip-list alongside doing the fixes. |
9b1db26
to
7c55e76
Compare
@stof PR now targets 7.3. |
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.
A lot of improvements for the components during the last days and this PR will be really helpful to iterate on the crawler. Thank you @mttsch!
Close #60669