/**
  * Assert that the user has the same information as the profile
  * @param Profile $profile
  * @param User $user
  */
 private function assertUser(Profile $profile, User $user, $message = null)
 {
     $expected = array_filter((array) $profile);
     // Slighlty adapt expected values
     unset($expected['identifier']);
     if (!isset($expected['email'])) {
         $expected['email'] = null;
     }
     $actual = ['photoURL' => $user->getPhoto(), 'displayName' => $user->getName(), 'email' => $user->getEmail(), 'phone' => $user->getPhone(), 'address' => $user->getStreet(), 'city' => $user->getLocality(), 'zip' => $user->getPostcode()];
     $this->assertEquals($expected, $actual, $message);
 }
Example #2
0
 public function testProfile()
 {
     $profile = new Profile();
     $profile->identifier = 'identifier';
     $profile->webSiteURL = 'webSiteURL';
     $profile->profileURL = 'profileURL';
     $profile->photoURL = 'photoURL';
     $profile->displayName = 'displayName';
     $profile->description = 'description';
     $profile->firstName = 'firstName';
     $profile->lastName = 'lastName';
     $profile->gender = 'male';
     $profile->language = 'language';
     $profile->age = 'age';
     $profile->birthDay = 'birthDay';
     $profile->birthMonth = 'birthMonth';
     $profile->birthYear = 'birthYear';
     $profile->email = 'email';
     $profile->emailVerified = 'emailVerified';
     $profile->phone = 'phone';
     $profile->address = 'address';
     $profile->country = 'CH';
     $profile->region = 'region';
     $profile->city = 'city';
     $profile->zip = 'zip';
     $country = new Country();
     $user = new User();
     $user->fromProfile($profile, $country);
     $this->assertSame('photoURL', $user->getPhoto());
     $this->assertSame('description', $user->getDescription());
     $this->assertSame('firstName', $user->getFirstname());
     $this->assertSame('lastName', $user->getLastname());
     $this->assertSame(1, $user->getSex());
     $this->assertSame('la', $user->getLanguage());
     $this->assertSame('phone', $user->getPhone());
     $this->assertSame('address', $user->getStreet());
     $this->assertSame($country, $user->getCountry());
     $this->assertSame('region', $user->getArea());
     $this->assertSame('city', $user->getLocality());
     $this->assertSame('zip', $user->getPostcode());
     $this->assertSame('email', $user->getEmail());
 }