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/CancelNotificationTest.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

103 lines
2.9 KiB
PHP

<?php
namespace PayPal\Test\Api;
use PayPal\Common\PayPalModel;
use PayPal\Api\CancelNotification;
/**
* Class CancelNotification
*
* @package PayPal\Test\Api
*/
class CancelNotificationTest extends \PHPUnit_Framework_TestCase
{
/**
* Gets Json String of Object CancelNotification
* @return string
*/
public static function getJson()
{
return '{"subject":"TestSample","note":"TestSample","send_to_merchant":true,"send_to_payer":true}';
}
/**
* Gets Object Instance with Json data filled in
* @return CancelNotification
*/
public static function getObject()
{
return new CancelNotification(self::getJson());
}
/**
* Tests for Serialization and Deserialization Issues
* @return CancelNotification
*/
public function testSerializationDeserialization()
{
$obj = new CancelNotification(self::getJson());
$this->assertNotNull($obj);
$this->assertNotNull($obj->getSubject());
$this->assertNotNull($obj->getNote());
$this->assertNotNull($obj->getSendToMerchant());
$this->assertNotNull($obj->getSendToPayer());
$this->assertEquals(self::getJson(), $obj->toJson());
return $obj;
}
/**
* @depends testSerializationDeserialization
* @param CancelNotification $obj
*/
public function testGetters($obj)
{
$this->assertEquals($obj->getSubject(), "TestSample");
$this->assertEquals($obj->getNote(), "TestSample");
$this->assertEquals($obj->getSendToMerchant(), true);
$this->assertEquals($obj->getSendToPayer(), true);
}
/**
* @depends testSerializationDeserialization
* @param CancelNotification $obj
*/
public function testDeprecatedGetters($obj)
{
$this->assertEquals($obj->getSend_to_merchant(), true);
$this->assertEquals($obj->getSend_to_payer(), true);
}
/**
* @depends testSerializationDeserialization
* @param CancelNotification $obj
*/
public function testDeprecatedSetterNormalGetter($obj)
{
// Check for Send_to_merchant
$obj->setSendToMerchant(null);
$this->assertNull($obj->getSend_to_merchant());
$this->assertNull($obj->getSendToMerchant());
$this->assertSame($obj->getSendToMerchant(), $obj->getSend_to_merchant());
$obj->setSend_to_merchant(true);
$this->assertEquals($obj->getSend_to_merchant(), true);
// Check for Send_to_payer
$obj->setSendToPayer(null);
$this->assertNull($obj->getSend_to_payer());
$this->assertNull($obj->getSendToPayer());
$this->assertSame($obj->getSendToPayer(), $obj->getSend_to_payer());
$obj->setSend_to_payer(true);
$this->assertEquals($obj->getSend_to_payer(), true);
//Test All Deprecated Getters and Normal Getters
$this->testDeprecatedGetters($obj);
$this->testGetters($obj);
}
}