Enabled Payout API Support

- Includes Unit and Functional Tests
- Includes Samples
This commit is contained in:
japatel
2015-01-02 16:41:36 -06:00
parent 9e7cb951a6
commit 6f13399e47
32 changed files with 4752 additions and 1165 deletions

View File

@@ -0,0 +1,89 @@
<?php
namespace PayPal\Test\Api;
use PayPal\Common\PayPalModel;
use PayPal\Api\PayoutBatch;
/**
* Class PayoutBatch
*
* @package PayPal\Test\Api
*/
class PayoutBatchTest extends \PHPUnit_Framework_TestCase
{
/**
* Gets Json String of Object PayoutBatch
* @return string
*/
public static function getJson()
{
return '{"batch_header":' .PayoutBatchHeaderTest::getJson() . ',"items":' .PayoutItemDetailsTest::getJson() . '}';
}
/**
* Gets Object Instance with Json data filled in
* @return PayoutBatch
*/
public static function getObject()
{
return new PayoutBatch(self::getJson());
}
/**
* Tests for Serialization and Deserialization Issues
* @return PayoutBatch
*/
public function testSerializationDeserialization()
{
$obj = new PayoutBatch(self::getJson());
$this->assertNotNull($obj);
$this->assertNotNull($obj->getBatchHeader());
$this->assertNotNull($obj->getItems());
$this->assertEquals(self::getJson(), $obj->toJson());
return $obj;
}
/**
* @depends testSerializationDeserialization
* @param PayoutBatch $obj
*/
public function testGetters($obj)
{
$this->assertEquals($obj->getBatchHeader(), PayoutBatchHeaderTest::getObject());
$this->assertEquals($obj->getItems(), PayoutItemDetailsTest::getObject());
}
/**
* @depends testSerializationDeserialization
* @param PayoutBatch $obj
*/
public function testDeprecatedGetters($obj)
{
$this->assertEquals($obj->getBatch_header(), PayoutBatchHeaderTest::getObject());
}
/**
* @depends testSerializationDeserialization
* @param PayoutBatch $obj
*/
public function testDeprecatedSetterNormalGetter($obj)
{
// Check for Batch_header
$obj->setBatchHeader(null);
$this->assertNull($obj->getBatch_header());
$this->assertNull($obj->getBatchHeader());
$this->assertSame($obj->getBatchHeader(), $obj->getBatch_header());
$obj->setBatch_header(PayoutBatchHeaderTest::getObject());
$this->assertEquals($obj->getBatch_header(), PayoutBatchHeaderTest::getObject());
//Test All Deprecated Getters and Normal Getters
$this->testDeprecatedGetters($obj);
$this->testGetters($obj);
}
}