Beispiel #1
0
 public function testFavoriteStatus()
 {
     $publication = new Publication();
     $this->assertFalse($publication->isFavorite());
     $publication->changeFavoriteStatus();
     $this->assertTrue($publication->isFavorite());
     $publication->changeFavoriteStatus();
     $this->assertFalse($publication->isFavorite());
 }
Beispiel #2
0
 private function hydrate(Publication $publication, $tweet)
 {
     if (1 !== preg_match('#\\bhttps?://[^\\s()<>]+(?:\\([\\w\\d]+\\)|([^[:punct:]\\s]|/))#', $tweet->text, $links)) {
         return $publication;
     }
     $publication->setUser($this->user);
     $publication->setSocialNetwork(Publication::TWITTER);
     $publication->setAuthor($tweet->user->name);
     $publication->setAuthorScreenName($tweet->user->screen_name);
     $publication->setPublishedAt(new \DateTime($tweet->created_at));
     $publication->setAuthorPicture($tweet->user->profile_image_url_https);
     $publication->setReference($tweet->id_str);
     $publication->setContent($tweet->text);
     $publication->setLinkUrl($links[0]);
     return $publication;
 }