unset($_POST['sf_method']); $request = new myRequest($dispatcher); $t->is($request->getMethod(), 'POST', '->getMethod() returns the "sf_method" parameter value if it exists and if the method is POST'); // ->getScriptName() $t->diag('->getScriptName()'); $request = new myRequest($dispatcher); $_SERVER['SCRIPT_NAME'] = '/frontend_test.php'; $_SERVER['ORIG_SCRIPT_NAME'] = '/frontend_test2.php'; $t->is($request->getScriptName(), '/frontend_test.php', '->getScriptName() returns the script name'); $request = new myRequest($dispatcher); unset($_SERVER['SCRIPT_NAME']); $_SERVER['ORIG_SCRIPT_NAME'] = '/frontend_test2.php'; $t->is($request->getScriptName(), '/frontend_test2.php', '->getScriptName() returns the script name if SCRIPT_NAME not set it use ORIG_SCRIPT_NAME'); $request = new myRequest($dispatcher); unset($_SERVER['SCRIPT_NAME']); $t->is($request->getScriptName(), '', '->getScriptName() returns the script name if SCRIPT_NAME and ORIG_SCRIPT_NAME not set it return empty'); // ->getPathInfo() $t->diag('->getPathInfo()'); $request = new myRequest($dispatcher); $options = $request->getOptions(); $t->is($options['path_info_key'], 'PATH_INFO', 'check if default path_info_key is PATH_INFO'); $request = new myRequest($dispatcher); $_SERVER['PATH_INFO'] = '/test/klaus'; $_SERVER['REQUEST_URI'] = '/test/klaus2'; $t->is($request->getPathInfo(), '/test/klaus', '->getPathInfo() returns the url path value'); $request = new myRequest($dispatcher, array(), array(), array('path_info_key' => 'SPECIAL')); $_SERVER['SPECIAL'] = '/special'; $t->is($request->getPathInfo(), '/special', '->getPathInfo() returns the url path value use path_info_key'); $request->resetPathInfoArray(); $request->resetPathInfoArray(); $request = new myRequest($dispatcher);