public function testWildcardShouldMatchDir() { $h = new HttpRequest("http://localhost/php-remoteStorage/api.php", "GET"); $h->setPathInfo("/admin/money/a/b/c/"); $self =& $this; $this->assertTrue($h->matchRest("GET", "/:user/:module/:path+/", function ($user, $module, $path) use($self) { $self->assertEquals("admin", $user); $self->assertEquals("money", $module); $self->assertEquals("a/b/c", $path); })); }
public function testDeleteAuthorization() { $h = new HttpRequest("http://www.example.org/api.php"); $h->setRequestMethod("DELETE"); $h->setPathInfo("/authorizations/testclient"); $h->setHeader("Authorization", "Bearer 12345abc"); // FIXME: test with non existing client_id! $response = $this->_api->handleRequest($h); $this->assertEquals(200, $response->getStatusCode()); $this->assertEquals('{"ok":true}', $response->getContent()); }