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/PayerInfoTest.php
Ganesh Hegde 50b09bdbde testcases updated
updated testcases to match new json schema
and updates with camel case function names
2013-05-28 10:08:34 +05:30

50 lines
1.4 KiB
PHP

<?php
namespace PayPal\Test\Api;
use PayPal\Api\PayerInfo;
use PayPal\Test\Constants;
class PayerInfoTest extends \PHPUnit_Framework_TestCase {
private $payerInfo;
public static $email = "test@paypal.com";
public static $firstName = "first";
public static $lastName = "last";
public static $phone = "408-1234-5687";
public static $payerId = "PAYER-1234";
public static function createPayerInfo() {
$payerInfo = new PayerInfo();
$payerInfo->setEmail(self::$email);
$payerInfo->setFirstName(self::$firstName);
$payerInfo->setLastName(self::$lastName);
$payerInfo->setPhone(self::$phone);
$payerInfo->setPayerId(self::$payerId);
$payerInfo->setShippingAddress(AddressTest::createAddress());
return $payerInfo;
}
public function setup() {
$this->payerInfo = self::createPayerInfo();
}
public function testGetterSetter() {
$this->assertEquals(self::$email, $this->payerInfo->getEmail());
$this->assertEquals(self::$firstName, $this->payerInfo->getFirstName());
$this->assertEquals(self::$lastName, $this->payerInfo->getLastName());
$this->assertEquals(self::$phone, $this->payerInfo->getPhone());
$this->assertEquals(self::$payerId, $this->payerInfo->getPayerId());
$this->assertEquals(AddressTest::$line1, $this->payerInfo->getShippingAddress()->getLine1());
}
public function testSerializeDeserialize() {
$p1 = $this->payerInfo;
$p2 = new PayerInfo();
$p2->fromJson($p1->toJson());
$this->assertEquals($p1, $p2);
}
}