Skip to content
This repository has been archived by the owner on Jan 8, 2020. It is now read-only.

Commit

Permalink
Merge branch 'master' of https://github.com/odino/zf2 into feature/tw…
Browse files Browse the repository at this point in the history
…itter-retweets
  • Loading branch information
weierophinney committed Jul 13, 2011
2 parents 848745a + 2ec0593 commit fe60cf8
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
14 changes: 14 additions & 0 deletions library/Zend/Service/Twitter.php
Expand Up @@ -903,6 +903,20 @@ public function blockBlocking($page = 1, $returnUserIds = false)
return new Rest\Client\Result($response->getBody());
}

/**
* Returns an array of user objects that retweeted the tweets identified with the given $id
*
* @param integer $id The Id of the tweet we want to know who retweeted
* @return \Zend\Rest\Client\Result
*/
public function statusRetweetedBy($id)
{
$this->_init();
$path = '/1/statuses/' . $this->_validInteger($id) . '/retweeted_by.xml';
$response = $this->_get($path);
return new Rest\Client\Result($response->getBody());
}

/**
* Protected function to validate that the integer is valid or return a 0
* @param $int
Expand Down
9 changes: 9 additions & 0 deletions tests/Zend/Service/Twitter/TwitterTest.php
Expand Up @@ -600,5 +600,14 @@ public function testTwitterObjectsSoNotShareSameHttpClientToPreventConflictingAu
$twitter2 = new Service\Twitter(array('username'=>'zftestuser2'));
$this->assertFalse($twitter1->getLocalHttpClient() === $twitter2->getLocalHttpClient());
}

public function testYouCanRetrieveTheUsersWhoRetweetedATweet()
{
$twitter = new Service\Twitter();
$response = $twitter->statusRetweetedBy(85607267692584960);

$this->assertTrue($response instanceof Rest\Client\Result);
$this->assertTrue(in_array('Alessandro Nadalin', $response->name));
}

}

0 comments on commit fe60cf8

Please sign in to comment.