public function testFetchAll() { $queryData = ['query' => 'value']; $request = new Request(); $request->setQuery(new Parameters($queryData)); $request->setUri('http://test.dev/testapi'); $request->setMethod(Request::METHOD_GET); $request->getHeaders()->addHeaders(array('Accept' => 'application/json')); $response = new Response(); $responseData = [['id' => 17, 'testName' => 'testValue1'], ['id' => 14, 'testName' => 'testValue2']]; $response->setContent(json_encode($responseData)); $httpClient = $this->getMock('Zend\\Http\\Client', array('send')); $httpClient->expects($this->once())->method('send')->with($this->equalTo($request))->will($this->returnValue($response)); $client = new Client($httpClient, 'http://test.dev/', ['Accept' => 'application/json']); $expected = [(object) ['id' => 17, 'testName' => 'testValue1'], (object) ['id' => 14, 'testName' => 'testValue2']]; $this->assertEquals($expected, $client->fetchAll('/testapi', $queryData)); }