Пример #1
0
 /**
  * testPut method
  *
  * @return void
  */
 public function testPut()
 {
     $request = new HttpRequest();
     $response = $request->put('httpbin.org/put', array('foo' => 'bar'));
     $this->assertEquals(200, $response->statusCode);
     $result = $response->json();
     $this->assertEquals('{"foo":"bar"}', $result['data']);
     $this->assertEquals('application/json', $result['headers']['Content-Type']);
     //Test POST with no data
     $response = $request->put('httpbin.org/put');
     $this->assertEquals(200, $response->statusCode);
     $result = $response->json();
     $this->assertEquals('', $result['data']);
     $this->assertEquals('application/json', $result['headers']['Content-Type']);
     $this->assertEquals('0', $result['headers']['Content-Length']);
 }