public function testId()
 {
     $forumId = rand();
     $forum = new Forum();
     $forum->setId($forumId);
     $this->assertEquals($forumId, $forum->getId());
 }
 private static function parseTopicDetails($item)
 {
     $crawler = new Crawler($item);
     $topic = new Forum();
     $topic->profile = new Profile();
     $topic->setTime($crawler->filter('div[style="padding-left: 3px;"]')->text());
     # message id.
     # Example:
     # <div class="forum_border_around" id="forumMsg30902219">...</div>
     $topic->setid(str_replace('forumMsg', '', $crawler->attr('id')));
     # image url.
     # Example:
     # <img src="http://cdn.myanimelist.net/images/useravatars/1901304.jpg" vspace="2" border="0">
     //Note: Some MAL users do not have any avatars in the forum!
     try {
         $topic->profile->setAvatarUrl($crawler->filter('img')->attr('src'));
     } catch (\InvalidArgumentException $e) {
         //do nothing
     }
     $details = explode("\n\t\t  ", $crawler->filter('td[class="forum_boardrow2"]')->text());
     $topic->setUsername($details[0]);
     $topic->profile->details->setForumPosts(str_replace('Posts: ', '', $details[6]));
     if ($details[1] == '') {
         $topic->profile->details->setAccessRank('Member');
     } else {
         $topic->profile->details->setAccessRank($details[1]);
     }
     if ($topic->profile->details->getForumPosts() == '') {
         $topic->profile->details->setStatus($details[3]);
         $topic->profile->details->setJoinDate(str_replace('Joined: ', '', $details[4]));
         $topic->profile->details->setForumPosts(str_replace('Posts: ', '', $details[5]));
     } else {
         $topic->profile->details->setStatus($details[4]);
         $topic->profile->details->setJoinDate(str_replace('Joined: ', '', $details[5]));
     }
     //to force json array and !objects.
     $topic->profile->manga_stats = null;
     $topic->profile->anime_stats = null;
     # comment.
     # Example:
     # <div id="message25496275">...</div>
     $topic->setComment($crawler->filter('div[id="message' . $topic->getId() . '"]')->html());
     return $topic;
 }