mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-18 18:46:17 +00:00
Adding router test case for URL generation with prefixes
git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@6635 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
parent
33a3a27fd1
commit
4b25239298
1 changed files with 22 additions and 2 deletions
|
@ -35,7 +35,6 @@ uses('router', 'debugger');
|
|||
* @subpackage cake.tests.cases.libs
|
||||
*/
|
||||
class RouterTest extends UnitTestCase {
|
||||
|
||||
function setUp() {
|
||||
$this->router =& Router::getInstance();
|
||||
}
|
||||
|
@ -427,7 +426,6 @@ class RouterTest extends UnitTestCase {
|
|||
$this->assertEqual($result, $expected);
|
||||
|
||||
$this->router->reload();
|
||||
//Configure::write('Routing.admin', false);
|
||||
|
||||
$this->router->setRequestInfo(array(
|
||||
array(
|
||||
|
@ -510,6 +508,28 @@ class RouterTest extends UnitTestCase {
|
|||
$expected = '/admin/shows/show_tickets/edit/6';
|
||||
$this->assertEqual($result, $expected);
|
||||
}
|
||||
|
||||
function testUrlGenerationWithPrefix() {
|
||||
Configure::write('Routing.admin', 'admin');
|
||||
$this->router->reload();
|
||||
|
||||
$this->router->connectNamed(array('event', 'lang'));
|
||||
$this->router->connect('/', array('controller' => 'pages', 'action' => 'display', 'home'));
|
||||
$this->router->connect('/pages/contact_us', array('controller' => 'pages', 'action' => 'contact_us'));
|
||||
$this->router->connect('/pages/*', array('controller' => 'pages', 'action' => 'display'));
|
||||
$this->router->connect('/reset/*', array('admin' => true, 'controller' => 'users', 'action' => 'reset'));
|
||||
$this->router->connect('/tests', array('controller' => 'tests', 'action' => 'index'));
|
||||
$this->router->parseExtensions('rss');
|
||||
|
||||
$this->router->setRequestInfo(array(
|
||||
array('pass' => array(), 'named' => array(), 'controller' => 'registrations', 'action' => 'admin_index', 'plugin' => '', 'prefix' => 'admin', 'admin' => true, 'url' => array('ext' => 'html', 'url' => 'admin/registrations/index'), 'form' => array()),
|
||||
array('base' => '', 'here' => '/admin/registrations/index', 'webroot' => '/')
|
||||
));
|
||||
|
||||
$result = $this->router->url(array('page' => 2));
|
||||
$expected = '/admin/registrations/index/page:2';
|
||||
$this->assertEqual($result, $expected);
|
||||
}
|
||||
|
||||
function testUrlGenerationWithExtensions() {
|
||||
$this->router->reload();
|
||||
|
|
Loading…
Add table
Reference in a new issue