Testing Zend_Controller wich is using Twitter API
- by ArneRie
Hi,
iam trying to write an unit test for an Controller wich calls the Twitter API through an Service class.
/**
* Authenticate Step 1 for Twitter
*/
public function authenticateAction()
{
$this->service->authenticate();
}
The Service does:
/**
* Authenticate with twitter
*
* @return void
*/
public function authenticate()
{
$consumer = new Zend_Oauth_Consumer($this->config);
$token = $consumer->getRequestToken();
$this->session->twitterRequestToken = serialize($token);
$consumer->redirect();
exit;
}
My Problem is, i have no idea to repleace the authenticate action inside the service for the unit test. I dont want to call the Twitter API while the tests run.
Is there any Mocking Framework wich can do such things?