예제 #1
0
 public function testDeleteCustomerFailure()
 {
     $httpResponse = $this->getMockHttpResponse('DeleteCustomerFailure.txt');
     $response = new Response($this->getMockRequest(), $httpResponse->json());
     $this->assertFalse($response->isSuccessful());
     $this->assertFalse($response->isRedirect());
     $this->assertNull($response->getTransactionReference());
     $this->assertNull($response->getCustomerReference());
     $this->assertSame('No such customer: cus_1MZeNih5LdKxDq', $response->getMessage());
 }
 /**
  * @uses TakePaymentCommandHandler::_handle()
  */
 function it_should_throw_a_payment_not_authorised_exception_if_stripe_payment_gateway_rejects_request(PaymentRepositoryInterface $repository, TakePaymentCommand $command, Response $response)
 {
     $this->setRepositoryMethodExpectations($repository);
     $this->clearRepositoryMarkAsPaidExpectation($repository);
     /** @noinspection PhpUndefinedMethodInspection */
     $response->isSuccessful()->willReturn(false);
     /** @noinspection PhpUndefinedMethodInspection */
     $response->getMessage()->willReturn('You have no money!');
     // @todo - I'd like to test this exception more accurately, but currently required exact object match, rather
     //         than like match
     $this->shouldThrow(PaymentNotAuthorisedException::class)->during('handle', [$command]);
 }