Example #1
0
 /**
  * testGetParams
  *
  * @return void
  * @access public
  */
 function testGetParams()
 {
     $paths = array('base' => '/', 'here' => '/products/display/5', 'webroot' => '/webroot');
     $params = array('param1' => '1', 'param2' => '2');
     Router::setRequestInfo(array($params, $paths));
     $expected = array('plugin' => false, 'controller' => false, 'action' => false, 'param1' => '1', 'param2' => '2');
     $this->assertEqual(Router::getparams(), $expected);
     $this->assertEqual(Router::getparam('controller'), false);
     $this->assertEqual(Router::getparam('param1'), '1');
     $this->assertEqual(Router::getparam('param2'), '2');
     Router::reload();
     $params = array('controller' => 'pages', 'action' => 'display');
     Router::setRequestInfo(array($params, $paths));
     $expected = array('plugin' => false, 'controller' => 'pages', 'action' => 'display');
     $this->assertEqual(Router::getparams(), $expected);
     $this->assertEqual(Router::getparams(true), $expected);
 }