330d843b8d98dcf09f20e238ff89bbdb69232982
[WP-Plugins/glm-member-db-registrations.git] /
1 <?php
2 use PayPal\Auth\Openid\PPOpenIdUserinfo;
3 /**
4  * Test class for PPOpenIdUserinfo.
5  *
6  */
7 class PPOpenIdUserinfoTest extends \PHPUnit_Framework_TestCase {
8         
9
10         /**
11          * Sets up the fixture, for example, opens a network connection.
12          * This method is called before a test is executed.
13          */
14         protected function setUp()
15         {
16         }
17         
18         /**
19          * Tears down the fixture, for example, closes a network connection.
20          * This method is called after a test is executed.
21          */
22         protected function tearDown()
23         {
24         }
25         
26
27         /**
28          * @test
29          */
30         public function testSerializationDeserialization() {
31                 $user = new PPOpenIdUserinfo();
32                 $user->setAccountType("PERSONAL")->setAgeRange("20-30")->setBirthday("1970-01-01")
33                         ->setEmail("me@email.com")->setEmailVerified(true)
34                         ->setFamilyName("Doe")->setMiddleName("A")->setGivenName("John")
35                         ->setLocale("en-US")->setGender("male")->setName("John A Doe")
36                         ->setPayerId("A-XZASASA")->setPhoneNumber("1-408-111-1111")
37                         ->setPicture("http://gravatar.com/me.jpg")
38                         ->setSub("me@email.com")->setUserId("userId")
39                         ->setVerifiedAccount(true)->setZoneinfo("America/PST");
40                 
41                 $userCopy = new PPOpenIdUserinfo();
42                 $userCopy->fromJson($user->toJSON());
43                 
44                 $this->assertEquals($user, $userCopy);
45         }
46 }