public function testMagicMethod() { $http = new Service($this->_testConfig); $response = $http->patch('some-path/stuff'); $expected = "http://localhost:80/some-path/stuff"; $result = $http->last->request->to('url'); $this->assertEqual($expected, $result); $response = $http->patch('some-path/stuff', array('someData' => 'someValue'), array('return' => 'response')); $result = $http->last->request; $this->assertEqual('PATCH', $result->method); $this->assertEqual('lithium\\net\\http\\Response', get_class($response)); }
public function testPatchWithJson() { $http = new Service($this->_testConfig); $response = $http->patch('some-path/stuff', array('someData' => 'someValue'), array('return' => 'response', 'type' => 'json')); $result = $http->last->request; $this->assertEqual('{"someData":"someValue"}', $result->body()); $this->assertEqual('application/json', $result->headers['Content-Type']); }