function it_should_throw_a_service_exception_when_a_request_fails(ClientStub $httpClient, Message $message) { $httpClient->post(Argument::type('string'), Argument::type('array'))->willThrow('Exception'); $message->getAll()->willReturn(['foo' => 'bar']); $this->shouldThrow('Mdb\\PayPal\\Ipn\\Exception\\ServiceException')->during('verifyIpnMessage', array($message)); }