Example #1
0
 public function testLoadArray()
 {
     $tweetData = array('id' => 293780221621067776, 'user' => array('id' => 14061545), 'created_at' => '2013-01-22 13:00:37', 'text' => "Archive My Tweets has a new look, and can now import your official twitter archive. https://t.co/e8HDtbYa", 'source' => '<a href="http://twitterrific.com" rel="nofollow">Twitterrific for Mac</a>', 'truncated' => 0, 'favorited' => 0, 'in_reply_to_status_id' => 0, 'in_reply_to_user_id' => 0, 'in_reply_to_screen_name' => 0);
     $t = new Tweet();
     $t->load_array($tweetData);
     foreach (array_keys($tweetData) as $key) {
         if ($key == 'user' || $key == 'text') {
             continue;
         }
         $this->assertEquals($tweetData[$key], $t->{$key});
     }
     $this->assertEquals($tweetData['user']['id'], $t->user_id);
     $this->assertEquals($tweetData['text'], $t->tweet);
 }