Adding \InvalidArgumentException tests to void() and reauthorize().

This commit is contained in:
brunoric
2014-08-22 17:49:30 -03:00
parent cc67faf822
commit bcd0b80e85

View File

@@ -143,9 +143,15 @@ class AuthorizationTest extends \PHPUnit_Framework_TestCase {
$void = $auth->void(); $void = $auth->void();
$this->assertNotNull($void->getId()); $this->assertNotNull($void->getId());
$auth->setId(null);
try {
$auth->void();
} catch (\InvalidArgumentException $ex) {
$this->assertEquals($ex->getMessage(), "Id cannot be null");
}
} }
public function testReauthorize(){ public function testReauthorize() {
$authorization = Authorization::get('7GH53639GA425732B'); $authorization = Authorization::get('7GH53639GA425732B');
$amount = new Amount(); $amount = new Amount();
@@ -153,10 +159,18 @@ class AuthorizationTest extends \PHPUnit_Framework_TestCase {
$amount->setTotal("1.00"); $amount->setTotal("1.00");
$authorization->setAmount($amount); $authorization->setAmount($amount);
try{ try {
$reauthorization = $authorization->reauthorize(); $authorization->reauthorize();
}catch (PPConnectionException $ex){ } catch (PPConnectionException $ex){
var_dump($ex->getMessage());
$this->assertEquals(strpos($ex->getMessage(),"500"), false); $this->assertEquals(strpos($ex->getMessage(),"500"), false);
} }
$authorization->setId(null);
try {
$authorization->reauthorize();
} catch (\InvalidArgumentException $ex) {
$this->assertEquals($ex->getMessage(), "Id cannot be null");
}
} }
} }