Created
September 1, 2017 14:52
-
-
Save ubermuda/4e352a065871edd139acb47b6d849aba to your computer and use it in GitHub Desktop.
This file contains 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
<?php | |
$event->setResponse(Argument::any())->will(function($args) use ($event) { | |
$event->getResponse()->willReturn($args[0]); | |
}); | |
// ->setResponse() happens inside ->onKernelException() | |
$subscriber->onKernelException($event->reveal()); | |
$event->getResponse(); // returns a MethodProphecy?! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I am trying to mock a
->setResponse($response)
call so that I can later retrieve the$response
object (via->getResponse()
) and do a few tests on it. As per the prophecy documentation, I use->will()
+ closure to make->getResponse()
return the argument passed to->setResponse()
, but after the->reveal()
and->setResponse()
,->getResponse()
returns aMethodProphecy
instance...