Skip to content

Commit

Permalink
Test the PATCH method
Browse files Browse the repository at this point in the history
  • Loading branch information
rmccue committed Aug 10, 2013
1 parent 1ed8c02 commit 062a17e
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions tests/Transport/Base.php
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,36 @@ public function testPUTWithArray() {
$this->assertEquals(array('test' => 'true', 'test2' => 'test'), $result['form']);
}

public function testRawPATCH() {
$data = 'test';
$request = Requests::patch('http://httpbin.org/patch', array(), $data, $this->getOptions());
$this->assertEquals(200, $request->status_code);

$result = json_decode($request->body, true);
$this->assertEquals('test', $result['data']);
}

public function testFormPATCH() {
$data = 'test=true&test2=test';
$request = Requests::patch('http://httpbin.org/patch', array(), $data, $this->getOptions());
$this->assertEquals(200, $request->status_code, $request->body);

$result = json_decode($request->body, true);
$this->assertEquals(array('test' => 'true', 'test2' => 'test'), $result['form']);
}

public function testPATCHWithArray() {
$data = array(
'test' => 'true',
'test2' => 'test',
);
$request = Requests::patch('http://httpbin.org/patch', array(), $data, $this->getOptions());
$this->assertEquals(200, $request->status_code);

$result = json_decode($request->body, true);
$this->assertEquals(array('test' => 'true', 'test2' => 'test'), $result['form']);
}

public function testDELETE() {
$request = Requests::delete('http://httpbin.org/delete', array(), $this->getOptions());
$this->assertEquals(200, $request->status_code);
Expand Down

0 comments on commit 062a17e

Please sign in to comment.