Skip to content

Cookie\Jar tests: stabilize and improve - #734

Merged
schlessera merged 4 commits into
developfrom
feature/497-cookiejar-tests-stabilize-and-improve
May 24, 2022
Merged

Cookie\Jar tests: stabilize and improve#734
schlessera merged 4 commits into
developfrom
feature/497-cookiejar-tests-stabilize-and-improve

Conversation

@jrfnl

@jrfnl jrfnl commented May 10, 2022

Copy link
Copy Markdown
Member

Cookie\Jar\GetIteratorTest: add message param to assertion

... as the same assertion is called multiple times.

Cookie\Jar\ArrayAccessTest: various minor improvements

  • 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.

Cookie\Jar\JarTest: stabilize tests

  • 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.

Cookie\Jar\JarTest: add extra test

.. to increase path coverage.

Related to #497

jrfnl added 4 commits May 11, 2022 00:10
... 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.
@jrfnl jrfnl added this to the 2.1.0 milestone May 10, 2022
@jrfnl
jrfnl requested a review from schlessera May 10, 2022 22:33
@schlessera
schlessera merged commit 936b8c4 into develop May 24, 2022
@schlessera
schlessera deleted the feature/497-cookiejar-tests-stabilize-and-improve branch May 24, 2022 06:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants