This repository has been archived on 2026-04-06. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
PayPal-PHP-SDK/tests/PayPal/Test/Api/PayoutBatchTest.php
japatel 6f13399e47 Enabled Payout API Support
- Includes Unit and Functional Tests
- Includes Samples
2015-01-02 16:41:36 -06:00

90 lines
2.3 KiB
PHP

<?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);
}
}