Cookie\Jar tests: stabilize and improve - #734
Merged
schlessera merged 4 commits intoMay 24, 2022
Merged
Conversation
... as the same assertion is called multiple times.
* Add `$message` parameter to all assertions.
* Add extra assertion to the `testCookieJarSetter()` test verifying the cookie value was set correctly.
As it was, if the value setting failed on both objects, the test would still have passed, which is not the intention.
* Use more specific assertions in the `testCookieJarUnsetter()` test.
The value returned for array access to an unset value was tested with `assertEmpty()`. In reality, the code is specifically set to return `null` for unset/not set values, so let's make the test more precise and test for `null`.
Along the same lines, we can use the more specific `assertArrayNotHasKey()` assertion instead of doing an `isset()` within an assertion.
* Add `$message` parameter to all assertions. * Add an additional assertion verifying that the request returned a `Response` instance. * Add an additional assertion checking that `$data['cookies']` is actually an array to the `setCookieRequest()` test helper method.
.. to increase path coverage.
16 tasks
schlessera
approved these changes
May 24, 2022
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.
Cookie\Jar\GetIteratorTest: add message param to assertion
... as the same assertion is called multiple times.
Cookie\Jar\ArrayAccessTest: various minor improvements
$messageparameter to all assertions.testCookieJarSetter()test verifying the cookie value was set correctly.As it was, if the value setting failed on both objects, the test would still have passed, which is not the intention.
testCookieJarUnsetter()test.The value returned for array access to an unset value was tested with
assertEmpty(). In reality, the code is specifically set to returnnullfor unset/not set values, so let's make the test more precise and test fornull.Along the same lines, we can use the more specific
assertArrayNotHasKey()assertion instead of doing anisset()within an assertion.Cookie\Jar\JarTest: stabilize tests
$messageparameter to all assertions.Responseinstance.$data['cookies']is actually an array to thesetCookieRequest()test helper method.Cookie\Jar\JarTest: add extra test
.. to increase path coverage.
Related to #497