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/OverrideChargeModelTest.php
japatel 9c0827643b Renaming Namespaces and Organizing Classes
- Updated OpenId classes to be in API namespace
- Updated PP Naming Convention to PayPal Naming Convention
- FormatConverter Class got its own namespace
- Handlers are grouped in Handler namespace
- Samples and Tests Updated Accordingly
2014-12-18 14:16:41 -06:00

90 lines
2.3 KiB
PHP

<?php
namespace PayPal\Test\Api;
use PayPal\Common\PayPalModel;
use PayPal\Api\OverrideChargeModel;
/**
* Class OverrideChargeModel
*
* @package PayPal\Test\Api
*/
class OverrideChargeModelTest extends \PHPUnit_Framework_TestCase
{
/**
* Gets Json String of Object OverrideChargeModel
* @return string
*/
public static function getJson()
{
return '{"charge_id":"TestSample","amount":' .CurrencyTest::getJson() . '}';
}
/**
* Gets Object Instance with Json data filled in
* @return OverrideChargeModel
*/
public static function getObject()
{
return new OverrideChargeModel(self::getJson());
}
/**
* Tests for Serialization and Deserialization Issues
* @return OverrideChargeModel
*/
public function testSerializationDeserialization()
{
$obj = new OverrideChargeModel(self::getJson());
$this->assertNotNull($obj);
$this->assertNotNull($obj->getChargeId());
$this->assertNotNull($obj->getAmount());
$this->assertEquals(self::getJson(), $obj->toJson());
return $obj;
}
/**
* @depends testSerializationDeserialization
* @param OverrideChargeModel $obj
*/
public function testGetters($obj)
{
$this->assertEquals($obj->getChargeId(), "TestSample");
$this->assertEquals($obj->getAmount(), CurrencyTest::getObject());
}
/**
* @depends testSerializationDeserialization
* @param OverrideChargeModel $obj
*/
public function testDeprecatedGetters($obj)
{
$this->assertEquals($obj->getCharge_id(), "TestSample");
}
/**
* @depends testSerializationDeserialization
* @param OverrideChargeModel $obj
*/
public function testDeprecatedSetterNormalGetter($obj)
{
// Check for Charge_id
$obj->setChargeId(null);
$this->assertNull($obj->getCharge_id());
$this->assertNull($obj->getChargeId());
$this->assertSame($obj->getChargeId(), $obj->getCharge_id());
$obj->setCharge_id("TestSample");
$this->assertEquals($obj->getCharge_id(), "TestSample");
//Test All Deprecated Getters and Normal Getters
$this->testDeprecatedGetters($obj);
$this->testGetters($obj);
}
}