Beispiel #1
0
 function testPUTRequest()
 {
     $client = new ClientMock(array('baseUri' => 'http://example.org/foo/bar/'));
     $responseBlob = array("HTTP/1.1 200 OK", "Content-Type: text/plain", "", "Hello there!");
     $client->response = array(implode("\r\n", $responseBlob), array('header_size' => 45, 'http_code' => 200), 0, "");
     $result = $client->request('PUT', 'bar', 'newcontent');
     $this->assertEquals('http://example.org/foo/bar/bar', $client->url);
     $this->assertEquals(array(CURLOPT_RETURNTRANSFER => true, CURLOPT_FOLLOWLOCATION => true, CURLOPT_MAXREDIRS => 5, CURLOPT_CUSTOMREQUEST => "PUT", CURLOPT_POSTFIELDS => 'newcontent', CURLOPT_HEADER => true, CURLOPT_HTTPHEADER => array()), $client->curlSettings);
 }