-
Notifications
You must be signed in to change notification settings - Fork 34
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
Implemented step theResponseShouldContainPartialJson #49
base: master
Are you sure you want to change the base?
Conversation
Does not check the whole JSON response keys per keys, but only the ones expected. Useful for time changing properties, for example
$keys = array_intersect($etalonKeys, $actualKeys); | ||
|
||
foreach ($keys as $key) { | ||
assertArrayHasKey($key, $etalon); |
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.
this does not make sense. you should assert what the response contain, not what the etalon contains
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.
You are right.
Hey @stof please check my last commit, hope this is ok now |
foreach ($expected as $key => $value) { | ||
assertArrayHasKey($key, $actual); | ||
if (is_array($value)) { | ||
$this->assertArrayPartiallyEquals($expected[$key], $actual[$key]); |
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.
you need to assert that $actual[$key]
is an array before calling the method to avoid a fatal error on the typehint
Added comments
Hello @stof sorry for the delay to fix this I added assertions to avoid the fatal errors, does it look good ? |
Does not check the whole JSON response keys per keys, but only the ones expected.
Useful for time changing properties, for example
Probably like #47