示例#1
0
$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);
$_SERVER['SCRIPT_NAME'] = '/frontend_test.php';
$_SERVER['REQUEST_URI'] = '/frontend_test.php/test/klaus2';
$_SERVER['QUERY_STRING'] = '';
$t->is($request->getPathInfo(), '/test/klaus2', '->getPathInfo() returns the url path value if it not exists use default REQUEST_URI');
$request = new myRequest($dispatcher);
$_SERVER['QUERY_STRING'] = 'test';
$_SERVER['REQUEST_URI'] = '/frontend_test.php/test/klaus2?test';
$t->is($request->getPathInfo(), '/test/klaus2', '->getPathInfo() returns the url path value if it not exists use default REQUEST_URI without query');
$request->resetPathInfoArray();
$request = new myRequest($dispatcher);
$t->is($request->getPathInfo(), '/', '->getPathInfo() returns the url path value if it not exists use default /');
// ->addRequestParameters() ->getRequestParameters() ->fixParameters()
$t->diag('getPathInfo');
$request = new myRequest($dispatcher);
$t->is($request->getRequestParameters(), array(), '->getRequestParameters() returns the request parameters default array');
$request->addRequestParameters(array('test' => 'test'));
$t->is($request->getRequestParameters(), array('test' => 'test'), '->getRequestParameters() returns the request parameters');
$request->addRequestParameters(array('test' => 'test'));
$t->is($request->getRequestParameters(), array('test' => 'test'), '->getRequestParameters() returns the request parameters allready exists');
$request->addRequestParameters(array('_sf_ignore_cache' => 1, 'test2' => 'test2'));
$t->is($request->getRequestParameters(), array('test' => 'test', 'test2' => 'test2', '_sf_ignore_cache' => 1), '->getRequestParameters() returns the request parameters check fixParameters call for special _sf_ params');
$t->is($request->getAttribute('sf_ignore_cache'), 1, '->getAttribute() check special param is set as attribute');
// ->checkCSRFProtection()
$t->diag('->checkCSRFProtection()');