Пример #1
0
 /**
  * @expectedException \RequestLab\Estat\EstatException
  */
 public function testQueryWithJsonError()
 {
     $this->clientMock->expects($this->once())->method('getAccessToken')->will($this->returnValue('token'));
     $this->queryMock->expects($this->once())->method('build')->with($this->equalTo('token'))->will($this->returnValue(array('content')));
     $this->httpAdapterMock->expects($this->once())->method('postContent')->with('https://ws.estat.com/gosu/rest/data/json', array('Content-Type' => 'application/json'), $this->equalTo(array('content')))->will($this->returnValue(json_encode(array('gosuResponse' => array('errorCode' => '999', 'errorMessage' => 'error')))));
     $this->service->query($this->queryMock);
 }
Пример #2
0
 /**
  * @expectedException \Widop\Twitter\OAuth\OAuthException
  * @expectedExceptionMessage An error occured when creating the OAuth token.
  */
 public function testGetRequestTokenError()
 {
     $response = $this->getMockBuilder('Widop\\HttpAdapter\\HttpResponse')->disableOriginalConstructor()->getMock();
     $response->expects($this->once())->method('getBody')->will($this->returnValue('foo'));
     $this->httpAdapter->expects($this->once())->method('postContent')->will($this->returnValue($response));
     $this->oauth->getRequestToken();
 }