/** * Calls the appropriate method in the appropriate Controller to carry out the appropriate action, specified by the URL * * @param string $controller_namespace * @param GenericController $controller * @param string $method * @since 0.1.1 */ private function performAction($controller_namespace, $controller, $method) { $arguments_expected = (new ReflectionMethod($controller_namespace, $method))->getNumberOfParameters(); $arguments = []; $request_parameters = $this->request->getParameters(); for ($i = 0; $i < $arguments_expected; $i++) { if ($i >= count($request_parameters)) { break; } $arguments[$i] = isset($request_parameters[$i]) ? $request_parameters[$i] : null; } call_user_func_array([$controller, $method], $arguments); }
/** * @dataProvider constructorProvider */ public function testQuery($url, $controller, $action, $parameters, $valid, $index, $query) { $request = new Request($url); $result = $request->getQuery() == $query; $this->assertTrue($result); }