Skip to content
This repository has been archived by the owner on Oct 30, 2020. It is now read-only.

Commit

Permalink
Adds purchase and validation tests. Extends TestCase
Browse files Browse the repository at this point in the history
  • Loading branch information
Craig Paul committed Oct 19, 2016
1 parent af058a8 commit ff055f3
Showing 1 changed file with 26 additions and 1 deletion.
27 changes: 26 additions & 1 deletion tests/GatewayTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@

use CraigPaul\Moneris\Gateway;
use CraigPaul\Moneris\Moneris;
use CraigPaul\Moneris\Response;
use CraigPaul\Moneris\Exceptions\ValidationException;

class GatewayTest extends PHPUnit_Framework_TestCase
class GatewayTest extends TestCase
{
/**
* The Moneris gateway.
Expand Down Expand Up @@ -77,4 +79,27 @@ public function it_can_access_properties_of_the_class()
$this->assertEquals($this->token, $this->gateway->token);
$this->assertEquals($this->environment, $this->gateway->environment);
}

/** @test */
public function it_can_validate_that_it_has_received_improper_parameters_to_make_a_purchase()
{
$this->expectException(ValidationException::class);

$this->gateway->purchase([]);
}

/** @test */
public function it_can_make_a_purchase_and_receive_a_response()
{
$params = [
'order_id' => '1234-567890',
'amount' => '1.00',
'pan' => $this->visa,
'expdate' => '2012',
];

$response = $this->gateway->purchase($params);

$this->assertEquals(Response::class, get_class($response));
}
}

0 comments on commit ff055f3

Please sign in to comment.