Skip to content

Commit

Permalink
Extending test coverage.
Browse files Browse the repository at this point in the history
  • Loading branch information
aperdomo committed Mar 25, 2016
1 parent 34e9c27 commit 67dbb77
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 18 deletions.
14 changes: 2 additions & 12 deletions src/Message/ConvergeAbstractRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ abstract class ConvergeAbstractRequest extends \Omnipay\Common\Message\AbstractR
protected $testEndpoint = 'https://demo.myvirtualmerchant.com/VirtualMerchantDemo';
protected $liveEndpoint = 'https://www.myvirtualmerchant.com/VirtualMerchant';

protected function getEndpoint()
public function getEndpoint()
{
return ($this->getTestMode()) ? $this->getTestEndpoint() : $this->getLiveEndpoint();
return ($this->getTestMode()) ? $this->testEndpoint : $this->liveEndpoint;
}

public function getMerchantId()
Expand Down Expand Up @@ -102,16 +102,6 @@ public function setSslLastName($value)
return $this->setParameter('ssl_last_name', $value);
}

public function getTestEndpoint()
{
return $this->testEndpoint;
}

public function getLiveEndpoint()
{
return $this->liveEndpoint;
}

protected function createResponse($response)
{
return $this->response = new ConvergeResponse($this, $response);
Expand Down
2 changes: 0 additions & 2 deletions tests/ConvergeGatewayTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ public function testAuthorize()
{
$request = $this->gateway->authorize($this->options);
$this->assertInstanceOf('Omnipay\Elavon\Message\ConvergeAuthorizeRequest', $request);

$this->assertSame('10.00', (string) $request->getAmount());
$this->assertSame('1.23', (string) $request->getSslSalesTax());
$this->assertSame('1', (string) $request->getSslInvoiceNumber());
Expand All @@ -44,7 +43,6 @@ public function testPurchase()
{
$request = $this->gateway->purchase($this->options);
$this->assertInstanceOf('Omnipay\Elavon\Message\ConvergePurchaseRequest', $request);

$this->assertSame('10.00', (string) $request->getAmount());
$this->assertSame('1.23', (string) $request->getSslSalesTax());
$this->assertSame('1', (string) $request->getSslInvoiceNumber());
Expand Down
26 changes: 24 additions & 2 deletions tests/Message/ConvergeAuthorizeRequestTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,30 @@ public function setUp()
);
}

public function testSslFirstName()
{
$this->assertSame($this->request, $this->request->setSslFirstName('Test'));
$this->assertSame('Test', $this->request->getSslFirstName());
}

public function testSslLastName()
{
$this->assertSame($this->request, $this->request->setSslLastName('Mann'));
$this->assertSame('Mann', $this->request->getSslLastName());
}

public function testGetTestEndpoint()
{
$this->assertSame($this->request, $this->request->setTestMode(true));
$this->assertSame('https://demo.myvirtualmerchant.com/VirtualMerchantDemo', $this->request->getEndpoint());
}

public function testGetLiveEndpoint()
{
$this->assertSame($this->request, $this->request->setTestMode(false));
$this->assertSame('https://www.myvirtualmerchant.com/VirtualMerchant', $this->request->getEndpoint());
}

public function testGetData()
{
$data = $this->request->getData();
Expand All @@ -43,7 +67,6 @@ public function testAuthorizeNoVID()
{
$this->setMockHttpResponse('NoVIDFailureResponse.txt');
$response = $this->request->send();

$this->assertFalse($response->isSuccessful());
$this->assertSame('The VirtualMerchant ID was not supplied in the authorization request.', $response->getMessage());
$this->assertSame('4000', $response->getCode());
Expand All @@ -53,7 +76,6 @@ public function testAuthorizeNoPIN()
{
$this->setMockHttpResponse('NoPINFailureResponse.txt');
$response = $this->request->send();

$this->assertFalse($response->isSuccessful());
$this->assertSame('The PIN was not supplied in the authorization request.', $response->getMessage());
$this->assertSame('4013', $response->getCode());
Expand Down
28 changes: 26 additions & 2 deletions tests/Message/ConvergePurchaseRequestTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,30 @@ public function setUp()
);
}

public function testSslFirstName()
{
$this->assertSame($this->request, $this->request->setSslFirstName('Test'));
$this->assertSame('Test', $this->request->getSslFirstName());
}

public function testSslLastName()
{
$this->assertSame($this->request, $this->request->setSslLastName('Mann'));
$this->assertSame('Mann', $this->request->getSslLastName());
}

public function testGetTestEndpoint()
{
$this->assertSame($this->request, $this->request->setTestMode(true));
$this->assertSame('https://demo.myvirtualmerchant.com/VirtualMerchantDemo', $this->request->getEndpoint());
}

public function testGetLiveEndpoint()
{
$this->assertSame($this->request, $this->request->setTestMode(false));
$this->assertSame('https://www.myvirtualmerchant.com/VirtualMerchant', $this->request->getEndpoint());
}

public function testGetData()
{
$data = $this->request->getData();
Expand All @@ -43,7 +67,7 @@ public function testPurchaseNoVID()
{
$this->setMockHttpResponse('NoVIDFailureResponse.txt');
$response = $this->request->send();

$this->assertFalse($response->isSuccessful());
$this->assertSame('The VirtualMerchant ID was not supplied in the authorization request.', $response->getMessage());
$this->assertSame('4000', $response->getCode());
Expand All @@ -53,7 +77,7 @@ public function testPurchaseNoPIN()
{
$this->setMockHttpResponse('NoPINFailureResponse.txt');
$response = $this->request->send();

$this->assertFalse($response->isSuccessful());
$this->assertSame('The PIN was not supplied in the authorization request.', $response->getMessage());
$this->assertSame('4013', $response->getCode());
Expand Down

0 comments on commit 67dbb77

Please sign in to comment.