public function testSend() { $oauthRequest = $this->getMock('Widop\\Twitter\\OAuth\\OAuthRequest'); $this->oauth->expects($this->once())->method('signRequest')->with($this->equalTo($oauthRequest), $this->equalTo($this->token)); $response = $this->getMockBuilder('Widop\\Twitter\\OAuth\\OAuthResponse')->disableOriginalConstructor()->getMock(); $this->oauth->expects($this->once())->method('sendRequest')->with($this->identicalTo($oauthRequest))->will($this->returnValue($response)); $request = $this->getMockBuilder('Widop\\Twitter\\Rest\\AbstractRequest')->setMethods(array('createOAuthRequest'))->getMockForAbstractClass(); $request->expects($this->once())->method('createOAuthRequest')->will($this->returnValue($oauthRequest)); $this->twitter->setToken($this->token); $this->assertSame($response, $this->twitter->send($request)); }