mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-09-06 03:22:39 +00:00
Adding fix for Ticket #2392
Added tests for this fix. git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@4848 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
parent
4e8a803e81
commit
a2ba6d7715
2 changed files with 33 additions and 2 deletions
|
@ -145,6 +145,37 @@ class RouterTest extends UnitTestCase {
|
|||
|
||||
$result = $this->router->url(array('controller' => 'posts', '0', '?' => 'var=test&var2=test2'));
|
||||
$this->assertEqual($result, $expected);
|
||||
|
||||
$this->router->routes = array();
|
||||
$this->router->connect('/posts/:value/:somevalue/:othervalue/*', array('controller' => 'posts', 'action' => 'view'), array('value','somevalue', 'othervalue'));
|
||||
$result = $this->router->parse('/posts/2007/08/01/title-of-post-here');
|
||||
$expected = array('value' => '2007', 'somevalue' => '08', 'othervalue' => '01', 'controller' => 'posts', 'action' => 'view', 'plugin' =>'', 'pass' => array('0' => 'title-of-post-here'));
|
||||
$this->assertEqual($result, $expected);
|
||||
|
||||
$this->router->routes = array();
|
||||
$this->router->connect('/posts/:year/:month/:day/*', array('controller' => 'posts', 'action' => 'view'), array('year' => $Year, 'month' => $Month, 'day' => $Day));
|
||||
$result = $this->router->parse('/posts/2007/08/01/title-of-post-here');
|
||||
$expected = array('year' => '2007', 'month' => '08', 'day' => '01', 'controller' => 'posts', 'action' => 'view', 'plugin' =>'', 'pass' => array('0' => 'title-of-post-here'));
|
||||
$this->assertEqual($result, $expected);
|
||||
|
||||
$this->router->routes = array();
|
||||
$this->router->connect('/posts/:day/:year/:month/*', array('controller' => 'posts', 'action' => 'view'), array('year' => $Year, 'month' => $Month, 'day' => $Day));
|
||||
$result = $this->router->parse('/posts/01/2007/08/title-of-post-here');
|
||||
$expected = array('day' => '01', 'year' => '2007', 'month' => '08', 'controller' => 'posts', 'action' => 'view', 'plugin' =>'', 'pass' => array('0' => 'title-of-post-here'));
|
||||
$this->assertEqual($result, $expected);
|
||||
|
||||
$this->router->routes = array();
|
||||
$this->router->connect('/posts/:month/:day/:year//*', array('controller' => 'posts', 'action' => 'view'), array('year' => $Year, 'month' => $Month, 'day' => $Day));
|
||||
$result = $this->router->parse('/posts/08/01/2007/title-of-post-here');
|
||||
$expected = array('month' => '08', 'day' => '01', 'year' => '2007', 'controller' => 'posts', 'action' => 'view', 'plugin' =>'', 'pass' => array('0' => 'title-of-post-here'));
|
||||
$this->assertEqual($result, $expected);
|
||||
|
||||
$this->router->routes = array();
|
||||
$this->router->connect('/posts/:year/:month/:day/*', array('controller' => 'posts', 'action' => 'view'));
|
||||
$result = $this->router->parse('/posts/2007/08/01/title-of-post-here');
|
||||
$expected = array('year' => '2007', 'month' => '08', 'day' => '01', 'controller' => 'posts', 'action' => 'view', 'plugin' =>'', 'pass' => array('0' => 'title-of-post-here'));
|
||||
$this->assertEqual($result, $expected);
|
||||
|
||||
}
|
||||
|
||||
function testAdminRouting() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue