-
Notifications
You must be signed in to change notification settings - Fork 29
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
Why expect function works unexpectedly? #88
Comments
I came across this problem as well and as far as I can tell, this manifests itself like this:
Code in the SUT ( $a = get_post_meta($postId, 'a', true);
$b = get_post_meta($postId, 'b', true);
error_log("a is '$a' and b is '$b'");
add_term_meta($termId, 'a', $a, true);
add_term_meta($termId, 'b', $b, true);
|
I can confirm that this is an issue, and that @abrain's assessment above is correct. expect()
->once() // Must be present, and must be first
->with() // Otherwise this is not validated
->andReturn(); // When this is present |
I've just validated that this issue does not apply to Mockery. (Mockery::mock('SomeClass'))
->shouldReceive()
->with() // This is validated, without needing `->once()`
->andReturn(); // And this is present |
When I run this code:
Result:
Failed asserting that null is identical to 'krya'.
. It looks well.But when I run this code:
OK (1 test, 1 assertion)
Works but why?
The text was updated successfully, but these errors were encountered: