Пример #1
0
 public function testPatch()
 {
     $data = ['testName' => 'testValue'];
     $request = new Request();
     $request->setContent(json_encode($data));
     $request->setUri('http://test.dev/testapi/17');
     $request->setMethod(Request::METHOD_PATCH);
     $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->patch('/testapi', 17, $data));
 }