/** * Runs the controller, allowing for _remap methods to function. * * @param mixed $class */ protected function runController($class) { if (method_exists($class, '_remap')) { $class->_remap($this->method, ...$this->router->params()); } else { $class->{$this->method}(...$this->router->params()); } $this->benchmark->stop('controller'); }
public function testClosures() { $router = new Router($this->collection); $router->handle('closure/123/alpha'); $closure = $router->controllerName(); $expects = call_user_func_array($closure, $router->params()); $this->assertTrue(is_callable($router->controllerName())); $this->assertEquals($expects, '123-alpha'); }