/** * @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); }