Ejemplo n.º 1
0
 /**
  * @expectedException \Widop\Twitter\OAuth\OAuthException
  * @expectedExceptionMessage The http response is not valid.
  */
 public function testSendRequestWithErroredRequest()
 {
     $request = $this->getMock('Widop\\Twitter\\OAuth\\OAuthRequest');
     $request->expects($this->once())->method('getMethod')->will($this->returnValue(OAuthRequest::METHOD_GET));
     $request->expects($this->once())->method('getUrl')->will($this->returnValue('url'));
     $request->expects($this->once())->method('getHeaders')->will($this->returnValue(array('header' => 'foo')));
     $request->expects($this->once())->method('getResponseFormat')->will($this->returnValue(OAuthResponse::FORMAT_JSON));
     $response = $this->getMockBuilder('Widop\\HttpAdapter\\HttpResponse')->disableOriginalConstructor()->getMock();
     $response->expects($this->once())->method('getBody')->will($this->returnValue('{"errors":"foo"}'));
     $this->httpAdapter->expects($this->once())->method('getContent')->with($this->identicalTo('url'), $this->identicalTo(array('header' => 'foo')))->will($this->returnValue($response));
     $this->oauth->sendRequest($request);
 }