From eeb2df97a8c50800d744dcbdaa6b5e6a8bc0a2c8 Mon Sep 17 00:00:00 2001 From: Craig Paul Date: Thu, 20 Oct 2016 08:26:50 -0600 Subject: [PATCH] Adds preauth test --- tests/GatewayTest.php | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/tests/GatewayTest.php b/tests/GatewayTest.php index 3415c16..642bc7d 100644 --- a/tests/GatewayTest.php +++ b/tests/GatewayTest.php @@ -29,8 +29,14 @@ public function setUp() { parent::setUp(); - $this->params = ['environment' => $this->environment]; - $this->gateway = Moneris::create($this->id, $this->token, $this->params)->connect(); + $params = ['environment' => $this->environment]; + $this->gateway = Moneris::create($this->id, $this->token, $params)->connect(); + $this->params = [ + 'order_id' => uniqid('1234-56789', true), + 'amount' => '1.00', + 'credit_card' => $this->visa, + 'expdate' => '2012', + ]; } /** @test */ @@ -55,14 +61,16 @@ public function it_can_access_properties_of_the_class() /** @test */ public function it_can_make_a_purchase_and_receive_a_response() { - $params = [ - 'order_id' => uniqid('1234-56789', true), - 'amount' => '1.00', - 'credit_card' => $this->visa, - 'expdate' => '2012', - ]; + $response = $this->gateway->purchase($this->params); + + $this->assertEquals(Response::class, get_class($response)); + $this->assertTrue($response->successful); + } - $response = $this->gateway->purchase($params); + /** @test */ + public function it_can_pre_authorize_a_purchase_and_receive_a_response() + { + $response = $this->gateway->preauth($this->params); $this->assertEquals(Response::class, get_class($response)); $this->assertTrue($response->successful);