forked from LiveCarta/PayPal-PHP-SDK
- Added API Classes, Samples, and Tests - Updated Functional Tests - Updated Documentation with new SDK Name - Updated Few Samples to use newer nicer result page
89 lines
2.3 KiB
PHP
89 lines
2.3 KiB
PHP
<?php
|
|
|
|
namespace PayPal\Test\Api;
|
|
|
|
use PayPal\Common\PPModel;
|
|
use PayPal\Api\Links;
|
|
|
|
/**
|
|
* Class Links
|
|
*
|
|
* @package PayPal\Test\Api
|
|
*/
|
|
class LinksTest extends \PHPUnit_Framework_TestCase
|
|
{
|
|
/**
|
|
* Gets Json String of Object Links
|
|
* @return string
|
|
*/
|
|
public static function getJson()
|
|
{
|
|
return '{"href":"TestSample","rel":"TestSample","targetSchema":' .HyperSchemaTest::getJson() . ',"method":"TestSample","enctype":"TestSample","schema":' .HyperSchemaTest::getJson() . '}';
|
|
}
|
|
|
|
/**
|
|
* Gets Object Instance with Json data filled in
|
|
* @return Links
|
|
*/
|
|
public static function getObject()
|
|
{
|
|
return new Links(self::getJson());
|
|
}
|
|
|
|
|
|
/**
|
|
* Tests for Serialization and Deserialization Issues
|
|
* @return Links
|
|
*/
|
|
public function testSerializationDeserialization()
|
|
{
|
|
$obj = new Links(self::getJson());
|
|
$this->assertNotNull($obj);
|
|
$this->assertNotNull($obj->getHref());
|
|
$this->assertNotNull($obj->getRel());
|
|
$this->assertNotNull($obj->getTargetSchema());
|
|
$this->assertNotNull($obj->getMethod());
|
|
$this->assertNotNull($obj->getEnctype());
|
|
$this->assertNotNull($obj->getSchema());
|
|
$this->assertEquals(self::getJson(), $obj->toJson());
|
|
return $obj;
|
|
}
|
|
|
|
/**
|
|
* @depends testSerializationDeserialization
|
|
* @param Links $obj
|
|
*/
|
|
public function testGetters($obj)
|
|
{
|
|
$this->assertEquals($obj->getHref(), "TestSample");
|
|
$this->assertEquals($obj->getRel(), "TestSample");
|
|
$this->assertEquals($obj->getTargetSchema(), HyperSchemaTest::getObject());
|
|
$this->assertEquals($obj->getMethod(), "TestSample");
|
|
$this->assertEquals($obj->getEnctype(), "TestSample");
|
|
$this->assertEquals($obj->getSchema(), HyperSchemaTest::getObject());
|
|
}
|
|
|
|
/**
|
|
* @depends testSerializationDeserialization
|
|
* @param Links $obj
|
|
*/
|
|
public function testDeprecatedGetters($obj)
|
|
{
|
|
}
|
|
|
|
/**
|
|
* @depends testSerializationDeserialization
|
|
* @param Links $obj
|
|
*/
|
|
public function testDeprecatedSetterNormalGetter($obj)
|
|
{
|
|
|
|
//Test All Deprecated Getters and Normal Getters
|
|
$this->testDeprecatedGetters($obj);
|
|
$this->testGetters($obj);
|
|
}
|
|
|
|
|
|
|
|
}
|