forked from LiveCarta/PayPal-PHP-SDK
Functional Tests Improvements and Refactoring
- Updated Functional Tests to refactor common code in one file - Re-sets the credentials to make sure previous tests doesnt change it for testing
This commit is contained in:
@@ -12,6 +12,7 @@ use PayPal\Common\PPModel;
|
||||
use PayPal\Rest\ApiContext;
|
||||
use PayPal\Rest\IResource;
|
||||
use PayPal\Api\CreateProfileResponse;
|
||||
use PayPal\Test\Functional\Setup;
|
||||
use PayPal\Transport\PPRestCall;
|
||||
use PayPal\Api\WebProfile;
|
||||
|
||||
@@ -27,8 +28,6 @@ class BillingAgreementsFunctionalTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
public $response;
|
||||
|
||||
public $mode = 'mock';
|
||||
|
||||
public $mockPPRestCall;
|
||||
|
||||
public function setUp()
|
||||
@@ -46,21 +45,7 @@ class BillingAgreementsFunctionalTest extends \PHPUnit_Framework_TestCase
|
||||
if (array_key_exists('body', $this->operation['response'])) {
|
||||
$this->response = json_encode($this->operation['response']['body']);
|
||||
}
|
||||
|
||||
$this->mode = getenv('REST_MODE') ? getenv('REST_MODE') : 'mock';
|
||||
if ($this->mode != 'sandbox') {
|
||||
|
||||
// Mock PPRest Caller if mode set to mock
|
||||
$this->mockPPRestCall = $this->getMockBuilder('\PayPal\Transport\PPRestCall')
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
$this->mockPPRestCall->expects($this->any())
|
||||
->method('execute')
|
||||
->will($this->returnValue(
|
||||
$this->response
|
||||
));
|
||||
}
|
||||
Setup::SetUpForFunctionalTests($this);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -94,7 +79,7 @@ class BillingAgreementsFunctionalTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testExecute($agreement)
|
||||
{
|
||||
if ($this->mode == 'sandbox') {
|
||||
if (Setup::$mode == 'sandbox') {
|
||||
$this->markTestSkipped('Not executable on sandbox environment. Needs human interaction');
|
||||
}
|
||||
$links = $agreement->getLinks();
|
||||
|
||||
Reference in New Issue
Block a user