-
-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Add test documentation for the component #21090
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?
Add test documentation for the component #21090
Conversation
Updates the documentation to document `JsonPathAssertionsTrait` and related constraints (closes symfony#20977). Complete the previous work done in symfony#21078.
e4e14e1
to
b1c2340
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.
Nice work Vincent! Thanks.
The trait provides the following assertion methods: | ||
|
||
* :method:`Symfony\\Component\\JsonPath\\Test\\JsonPathAssertionsTrait::assertJsonPathCount` | ||
Asserts that the number of elements found by the JSONPath expression matches an expected count:: |
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.
There's a minor RST syntax here. The contents of list items must use the same indentation and the code inside it must be indeneted by 4 spaces. E.g., the first item here should be:
* :method:`Symfony\\Component\\JsonPath\\Test\\JsonPathAssertionsTrait::assertJsonPathCount`
Asserts that the number of elements found by the JSONPath expression matches an expected count::
$json = '{"a": [1, 2, 3]}';
self::assertJsonPathCount(3, '$.a[*]', $json);
self::assertJsonPathCount(3, '$.a[*]', $json); | ||
|
||
* :method:`Symfony\\Component\\JsonPath\\Test\\JsonPathAssertionsTrait::assertJsonPathEquals` | ||
Asserts that the result of a JSONPath expression is equal (``==``) to an expected value. This assertion uses type coercion:: |
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'd use this to make sure nobody misses this:
Asserts that the result of a JSONPath expression is equal to an expected value.
The comparison uses ``==`` (type coercion) instead of ``===``::
self::assertJsonPathEquals(['1'], '$.a[0]', $json); | ||
|
||
* :method:`Symfony\\Component\\JsonPath\\Test\\JsonPathAssertionsTrait::assertJsonPathNotEquals` | ||
Asserts that the result of a JSONPath expression is not equal (``!=``) to an expected value:: |
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'd do the same reword here as in the previous example of euqals
.
Updates the documentation to document
JsonPathAssertionsTrait
and related constraints (closes #20977).Complete the previous work done in #21078.