_post = $_POST; } public function teardown() { $_POST = $this->_post; } public function request_method_test() { foreach (array("GET", "POST") as $method) { foreach (array("", "PUT", "DELETE") as $tunnel) { if ($method == "GET") { $expected = "GET"; } else { $expected = $tunnel == "" ? $method : $tunnel; } $_SERVER["REQUEST_METHOD"] = $method; $_POST["_method"] = $tunnel; $this->assert_equal(strtolower(rest::request_method()), strtolower($expected), "Request method: {$method}, tunneled: {$tunnel}"); } } } }