コード例 #1
0
// getPublicTimeline()
$t->diag('getPublicTimeline()');
$tweets = $client->getPublicTimeline();
$t->isa_ok($tweets, 'TweetCollection', 'getPublicTimeline() retrieves a tweet collection');
$t->is($tweets[0]->user->screen_name, 'Susy67', 'getPublicTimeline() retrieves correctly the first tweet author');
// getRateLimitStatus()
$t->diag('getRateLimitStatus()');
$status = $client->getRateLimitStatus();
$t->isa_ok($status, 'array', 'getRateLimitStatus() retrieves an hash of status infos');
$t->is($status['remaining-hits'], 59, 'getRateLimitStatus() retrieves remaining-hits');
$t->is($status['reset-time'], '2009-06-07T15:37:57+00:00', 'getRateLimitStatus() retrieves reset-time');
$t->is($status['hourly-limit'], 100, 'getRateLimitStatus() retrieves hourly-limit');
$t->is($status['reset-time-in-seconds'], 1244389077, 'getRateLimitStatus() retrieves reset-time-in-seconds');
// getReplies()
$t->diag('getReplies()');
$tweets = $client->getReplies();
$t->isa_ok($tweets, 'TweetCollection', 'getReplies() retrieves a TweetCollection');
$t->isa_ok($tweets[0], 'Tweet', 'getReplies() retrieves tweets');
$t->is($tweets[0]->user->screen_name, 'Mitternacht', 'getReplies() a valid collection of tweets');
// getSentDirectMessages()
$t->diag('getSentDirectMessages()');
$dms = $client->getSentDirectMessages();
$t->isa_ok($dms, 'TwitterDirectMessageCollection', 'getSentDirectMessages() retrieves a TwitterDirectMessageCollection');
$t->is($dms[0]->sender->screen_name, 'n1k0', 'getSentDirectMessages() retrieves correctly dm sender');
$t->is($dms[0]->recipient->screen_name, 'duboisnicolas', 'getSentDirectMessages() retrieves correctly dm recipient');
// getStatus()
$t->diag('getStatus()');
$tweet = $client->getStatus(2043091669);
$t->isa_ok($tweet, 'Tweet', 'getStatus() retrieves a tweet');
$t->is($tweet->user->screen_name, 'n1k0', 'getStatus() a valid tweet title');
// getUser()