Skip to content

Commit f2519bc

Browse files
authored
Merge pull request #3 from sudiptpa/e/tests
Added gatway tests
2 parents 625d7e2 + 865ab60 commit f2519bc

File tree

2 files changed

+60
-2
lines changed

2 files changed

+60
-2
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ The following gateways are provided by this package:
3737
use Omnipay\Common\CreditCard;
3838

3939
$gateway = Omnipay::create('NABTransact_SecureXML');
40-
$gateway->setMerchantId('ABC0001');
41-
$gateway->setTransactionPassword('abc123');
40+
$gateway->setMerchantId('XYZ0010');
41+
$gateway->setTransactionPassword('abcd1234');
4242
$gateway->setTestMode(true);
4343

4444
$card = new CreditCard([

tests/SecureXMLGatewayTest.php

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
<?php
2+
3+
namespace Omnipay\NABTransact;
4+
5+
use Omnipay\Tests\GatewayTestCase;
6+
7+
class SecureXMLGatewayTest extends GatewayTestCase
8+
{
9+
public function setUp()
10+
{
11+
parent::setUp();
12+
13+
$this->gateway = new SecureXMLGateway($this->getHttpClient(), $this->getHttpRequest());
14+
$this->gateway->setMerchantId('ABC0001');
15+
}
16+
17+
public function testEcho()
18+
{
19+
$request = $this->gateway->echoTest(array('amount' => '10.00', 'transactionId' => 'Order-YKHU67'));
20+
$this->assertInstanceOf('\Omnipay\NABTransact\Message\SecureXMLEchoTestRequest', $request);
21+
$this->assertSame('10.00', $request->getAmount());
22+
$this->assertSame('Order-YKHU67', $request->getTransactionId());
23+
}
24+
25+
public function testAuthorize()
26+
{
27+
$request = $this->gateway->authorize(array('amount' => '10.00'));
28+
29+
$this->assertInstanceOf('\Omnipay\NABTransact\Message\SecureXMLAuthorizeRequest', $request);
30+
$this->assertSame('10.00', $request->getAmount());
31+
}
32+
33+
public function testCapture()
34+
{
35+
$request = $this->gateway->capture(array('amount' => '10.00', 'transactionId' => 'Order-YKHU67'));
36+
37+
$this->assertInstanceOf('\Omnipay\NABTransact\Message\SecureXMLCaptureRequest', $request);
38+
$this->assertSame('10.00', $request->getAmount());
39+
$this->assertSame('Order-YKHU67', $request->getTransactionId());
40+
}
41+
42+
public function testPurchase()
43+
{
44+
$request = $this->gateway->purchase(array('amount' => '10.00'));
45+
46+
$this->assertInstanceOf('\Omnipay\NABTransact\Message\SecureXMLPurchaseRequest', $request);
47+
$this->assertSame('10.00', $request->getAmount());
48+
}
49+
50+
public function testRefund()
51+
{
52+
$request = $this->gateway->refund(array('amount' => '10.00', 'transactionId' => 'Order-YKHU67'));
53+
54+
$this->assertInstanceOf('\Omnipay\NABTransact\Message\SecureXMLRefundRequest', $request);
55+
$this->assertSame('10.00', $request->getAmount());
56+
$this->assertSame('Order-YKHU67', $request->getTransactionId());
57+
}
58+
}

0 commit comments

Comments
 (0)