From 61abbb5aaa96e76291a72ce7a0c41f408cb67f23 Mon Sep 17 00:00:00 2001 From: Matt Glaman Date: Fri, 11 Aug 2017 23:23:29 -0500 Subject: [PATCH] AuthTransactionTest::testAuthTransaction randomly fails (#23) --- .../CreateTransactionRequest/AuthTransactionTest.php | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/tests/CreateTransactionRequest/AuthTransactionTest.php b/tests/CreateTransactionRequest/AuthTransactionTest.php index 32cfe2d..4f042cc 100644 --- a/tests/CreateTransactionRequest/AuthTransactionTest.php +++ b/tests/CreateTransactionRequest/AuthTransactionTest.php @@ -16,14 +16,13 @@ public function testAuthTransaction() ->setTransactionRequest($transactionRequest); $response = $request->execute(); $this->assertTrue(isset($response->transactionResponse)); - $this->assertEquals('I00001', $response->getMessages()[0]->getCode()); - $this->assertEquals('Successful.', $response->getMessages()[0]->getText()); - $this->assertEquals('Ok', $response->getResultCode()); + $this->assertResponse($response, 'I00001', 'Successful.', 'Ok'); + sleep(1); // Use a new number, otherwise a duplicate transaction is flagged. $transactionRequest = $this->createChargableTransactionRequest( - TransactionRequest::AUTH_CAPTURE, + TransactionRequest::AUTH_ONLY, '4007000000027' ); @@ -33,8 +32,6 @@ public function testAuthTransaction() ->setTransactionRequest($transactionRequest); $response = $request->execute(); $this->assertTrue(isset($response->transactionResponse)); - $this->assertEquals('I00001', $response->getMessages()[0]->getCode()); - $this->assertEquals('Successful.', $response->getMessages()[0]->getText()); - $this->assertEquals('Ok', $response->getResultCode()); + $this->assertResponse($response, 'I00001', 'Successful.', 'Ok'); } }