コード例 #1
0
$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()
$t->diag('getUser()');
$user = $client->getUser(6896142);
$t->isa_ok($user, 'TwitterUser', 'getUser() retrieves a TwitterUser');
$t->is($user->screen_name, 'ancailliau', 'getUser() a valid user screen name');
// getUserTimeline()
$t->diag('getUserTimeline()');
$tweets = $client->getUserTimeline();
$t->isa_ok($tweets, 'TweetCollection', 'getUserTimeline() retrieves a TweetCollection');
$t->isa_ok($tweets[0], 'Tweet', 'getUserTimeline() retrieves tweets');
$t->is($tweets[0]->user->screen_name, 'n1k0', 'getUserTimeline() a valid collection of tweets');
// isDuplicateStatus()
$t->diag('isDuplicateStatus()');
$tweets = $client->getUserTimeline();
$tweet = $tweets[0];
$t->ok($client->isDuplicateStatus("don't understand all this #home bashing", 1), 'isDuplicateStatus() detects duplicate status');
$t->ok(!$client->isDuplicateStatus("gnagnaghn", 1), 'isDuplicateStatus() does not detect fake duplicate status');
// search()
$t->diag('search()');
$results = $client->search('foo');
$t->isa_ok($results, 'TweetCollection', 'search() retrieves a TweetCollection');
$t->is($results[0]->text, 'Obama Saturday said North Korea`s nuclear weapon test had been "extraordinarily provocative". "Profoundly dangerous" for Iran to get nukes.', 'search() retrieves first result text okay');
$t->is($results[0]->id, 2065832081, 'search() retrieves first result id okay');