forked from LiveCarta/PayPal-PHP-SDK
Enabled Payout API Support
- Includes Unit and Functional Tests - Includes Samples
This commit is contained in:
89
tests/PayPal/Test/Api/PayoutBatchTest.php
Normal file
89
tests/PayPal/Test/Api/PayoutBatchTest.php
Normal 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);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user