public function testCallHttpPost() { $data = ['testName' => 'testValue']; $request = new Request(); $request->setUri('http://test.dev/testapi'); $request->setMethod(Request::METHOD_POST); $request->setContent(json_encode($data)); $request->getHeaders()->addHeaders(array('Accept' => 'application/json')); $response = new Response(); $responseData = ['id' => 17, 'testName' => 'testValue']; $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']); $this->assertEquals((object) $responseData, $client->call('/testapi', Request::METHOD_POST, $data)); }