示例#1
0
 /**
  * @test
  */
 public function itShouldBuildTheObject()
 {
     $user = TwitterUser::create($this->id, $this->screenName, $this->name, $this->lang, $this->location, $this->profileHttpUrl, $this->profileHttpsUrl);
     $this->assertEquals($this->id, $user->getId());
     $this->assertEquals($this->name, $user->getName());
     $this->assertEquals($this->screenName, $user->getScreenName());
     $this->assertEquals($this->lang, $user->getLang());
     $this->assertEquals($this->location, $user->getLocation());
     $this->assertEquals($this->profileHttpUrl, $user->getProfileImageUrl());
     $this->assertEquals($this->profileHttpsUrl, $user->getProfileImageUrlHttps());
     $this->assertEquals('@' . $this->screenName, (string) $user);
 }
 /**
  * Unserialize a twitter user
  *
  * @param  \stdClass $obj
  * @param  array     $context
  * @return TwitterUser
  */
 public function unserialize($obj, array $context = [])
 {
     Assertion::true($this->canUnserialize($obj), 'object is not unserializable');
     return TwitterUser::create($obj->id, $obj->screen_name, $obj->name, $obj->lang, $obj->location, $obj->profile_background_image_url, $obj->profile_background_image_url_https);
 }
示例#3
0
 /**
  * @return TwitterUser
  */
 private function getValidObject()
 {
     $twitterUser = TwitterUser::create($this->id, $this->screenName, $this->name, $this->lang, $this->location, $this->profileImageUrl, $this->profileImageUrlHttps);
     return $twitterUser;
 }