mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-03-28 12:42:58 +00:00
Adding test case to explain how route prefix matching functions (Ticket #3494)
git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@5924 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
parent
d913e88ef5
commit
1ab95d703f
1 changed files with 25 additions and 0 deletions
|
@ -778,6 +778,31 @@ class RouterTest extends UnitTestCase {
|
|||
$this->assertEqual($result, $expected);
|
||||
}
|
||||
|
||||
function testUrlGenerationWithPrefixes() {
|
||||
$this->router->reload();
|
||||
|
||||
$this->router->connect('/protected/:controller/:action/*', array(
|
||||
'controller' => 'users',
|
||||
'action' => 'index',
|
||||
'prefix' => 'protected',
|
||||
'protected' => true
|
||||
));
|
||||
$this->router->parse('/');
|
||||
|
||||
$this->router->setRequestInfo(array(
|
||||
array('plugin' => null, 'controller' => 'images', 'action' => 'index', 'pass' => array(), 'prefix' => null, 'admin' => false, 'form' => array(), 'url' => array('url' => 'images/index'), 'bare' => 0, 'webservices' => null),
|
||||
array('plugin' => null, 'controller' => null, 'action' => null, 'base' => '', 'here' => '/images/index', 'webroot' => '/')
|
||||
));
|
||||
|
||||
$result = $this->router->url(array('controller' => 'images', 'action' => 'add'));
|
||||
$expected = '/images/add';
|
||||
$this->assertEqual($result, $expected);
|
||||
|
||||
$result = $this->router->url(array('controller' => 'images', 'action' => 'add', 'protected' => true));
|
||||
$expected = '/protected/images/add';
|
||||
$this->assertEqual($result, $expected);
|
||||
}
|
||||
|
||||
function testParamsUrlParsing() {
|
||||
$this->router->reload();
|
||||
$this->router->connect('/', array('controller' => 'posts', 'action' => 'index'));
|
||||
|
|
Loading…
Add table
Reference in a new issue