public function testStaticRoute() { // Create Router $router = new \Bramus\Router\Router(); $router->match('GET', '/about', function () { echo 'about'; }); // Test the /about route ob_start(); $_SERVER['REQUEST_URI'] = '/about'; $router->run(); $this->assertEquals('about', ob_get_contents()); // Cleanup ob_end_clean(); }
$events['auth0']['method'] = 'secure'; $events['auth0']['authorized'] = false; $events['auth0']['api'] = true; $events['auth0']['user'] = true; $events['auth0']['message'] = 'No permissions.'; echo json_encode(array('events' => $events)); exit; } }); /** * These is the public API to get Forplay content. */ $router->match('POST|GET', '(get.*|search.*|forplay.*|google.*)', function () { global $events; $events['auth0']['method'] = 'public'; $events['auth0']['authorized'] = true; $events['auth0']['api'] = true; $events['auth0']['user'] = true; }); /** * These is the private API save Forplay content and see the log. */ $router->match('POST|GET', '(log.*|save.*|imgs.*|sitemap.*)', function () { global $events; $events['auth0']['method'] = 'secure'; $events['auth0']['authorized'] = true; $events['auth0']['api'] = true; $events['auth0']['user'] = true; }); /** * If someone tries to access unknown API.