Updated Testing Framework fixing Travis Builds

- Added Group  and Catching errors
This commit is contained in:
Jay Patel
2014-09-21 20:37:34 -05:00
parent 1d43f9cfe0
commit 6e14f51aa5
7 changed files with 85 additions and 45 deletions

View File

@@ -15,6 +15,14 @@
</testsuite>
</testsuites>
<groups>
<exclude>
<group>
integration
</group>
</exclude>
</groups>
<logging>
<log type="junit" target="build/junit.xml" logIncompleteSkipped="false" />
<log type="coverage-html" target="build/coverage/" charset="UTF-8"

View File

@@ -122,6 +122,10 @@ class AuthorizationTest extends \PHPUnit_Framework_TestCase {
$a2->fromJson($a1->toJson());
$this->assertEquals($a1, $a2);
}
/**
* @group integration
*/
public function testOperations() {
try {
$authId = self::authorize();
@@ -150,13 +154,16 @@ class AuthorizationTest extends \PHPUnit_Framework_TestCase {
} catch (\InvalidArgumentException $ex) {
$this->assertEquals($ex->getMessage(), "Id cannot be null");
}
} catch (\PayPal\Exception\PPConnectionException $ex) {
} catch (PPConnectionException $ex) {
$this->markTestSkipped(
'Tests failing because of intermittent failures in Paypal Sandbox environment.' . $ex->getMessage()
);
}
}
/**
* @group integration
*/
public function testReauthorize() {
$authorization = Authorization::get('7GH53639GA425732B');

View File

@@ -56,8 +56,12 @@ class CaptureTest extends \PHPUnit_Framework_TestCase {
$this->assertEquals($c1, $c2);
}
/**
* @group integration
*/
public function testOperations()
{
try {
$authId = AuthorizationTest::authorize();
$auth = Authorization::get($authId);
@@ -82,6 +86,11 @@ class CaptureTest extends \PHPUnit_Framework_TestCase {
$retund = $capture->refund($refund);
$this->assertNotNull($retund->getId());
} catch (PPConnectionException $ex) {
$this->markTestSkipped(
'Tests failing because of intermittent failures in Paypal Sandbox environment.' . $ex->getMessage()
);
}
}
}

View File

@@ -71,6 +71,9 @@ class CreditCardTest extends \PHPUnit_Framework_TestCase {
$this->assertEquals($c1, $c2);
}
/**
* @group integration
*/
public function testOperations() {
$c1 = $this->cards['full'];

View File

@@ -66,6 +66,9 @@ class PaymentTest extends \PHPUnit_Framework_TestCase {
$this->assertEquals($p2, $this->payments['full']);
}
/**
* @group integration
*/
public function testOperations() {
$p1 = $this->payments['new'];

View File

@@ -7,6 +7,7 @@ use PayPal\Test\Constants;
use PayPal\Test\Api\AmountTest;
use PayPal\Test\Api\PaymentTest;
use PayPal\Test\Api\LinksTest;
use PayPal\Exception\PPConnectionException;
class SaleTest extends \PHPUnit_Framework_TestCase {
@@ -52,7 +53,11 @@ class SaleTest extends \PHPUnit_Framework_TestCase {
$this->assertEquals($s1, $s2);
}
/**
* @group integration
*/
public function testOperations() {
try {
$payment = PaymentTest::createNewPayment();
$payment->create();
@@ -69,5 +74,10 @@ class SaleTest extends \PHPUnit_Framework_TestCase {
$this->setExpectedException('\InvalidArgumentException');
$sale->refund(NULL);
} catch (PPConnectionException $ex) {
$this->markTestSkipped(
'Tests failing because of intermittent failures in Paypal Sandbox environment.' . $ex->getMessage()
);
}
}
}