Closed Leuloch closed 7 years ago
To unable mock response for tests, we need to inject Guzzle\Plugin\Mock\MockPlugin when creating the gateway like so:
class ApplicationTest extends TestCase { public function testOmnipayManager() { // Create gateway using mocked HttpClient $this->gateway = \Omnipay::gateway('pagarme', $this->getHttpClient(), $this->getHttpRequest()); // Add Expected Response from the API $this->setMockHttpResponse('AuthorizeCardSuccess.txt'); $request = $this->gateway->authorize( [ 'amount' => '10.00', 'soft_descriptor' => 'test', ] ); $response = $request->send(); $this->assertTrue($response->isSuccessful()); }
More info: http://guzzle3.readthedocs.org/testing/unit-testing.html#queueing-mock-responses
@alexw23
To unable mock response for tests, we need to inject Guzzle\Plugin\Mock\MockPlugin when creating the gateway like so:
More info: http://guzzle3.readthedocs.org/testing/unit-testing.html#queueing-mock-responses
@alexw23