-
Notifications
You must be signed in to change notification settings - Fork 62
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
Fatal error when using closure in callback matcher #33
Comments
Which version of super closure are you using? Which version of PHPUnit are you using? |
I'm using PHPUnit 5.5.0 and SuperClosure 2.2.0 |
Can you try changing your setup to this: $this->http->mock
->when()
->methodIs($method)
->pathIs($path)
->callback(static function(Request $request) use ($requestHeaders) {
foreach ($requestHeaders as $header => $value) {
if (!$request->headers->has($header) || $request->headers->get($header) !== $value) {
return false;
}
}
return true;
})
->then()
->statusCode(200)
->body('ok')
->end(); |
I tried it and result is the same as before - fatal error again. |
Hmmmm, that’s strange. What's your PHP version? |
5.6.23 |
Very weird, I tried exactly your example locally with both PHP 7 and PHP 5.6 and I am unable to reproduce it. Can you try digging down |
Hi,
I'm trying to create a mock with headers validation. I'm using callback for that.
I'm getting this error:
My code looks like this:
Because of that bug, I cannot validate expected request headers. Could you please provide some alternative method to validate request headers until this issue is fixed?
Thanks
The text was updated successfully, but these errors were encountered: