09.03 php saved
Jippi
Tags add more
1.2, fail, router and test  
Note
1.2 router test failing
  1. function testPrefixUser() {
  2.         $this->router->reload();
  3.  
  4.         // Frontpage
  5.         $this->router->connect('/', array('controller' => 'pages', 'action' => 'display', 'index'));
  6.  
  7.         // Static pages
  8.         $this->router->connect('/pages/*', array('controller' => 'pages', 'action' => 'display'));
  9.  
  10.         // TestSuite
  11.         $this->router->connect('/tests', array('controller' => 'tests', 'action' => 'index'));
  12.  
  13.         // Protected area
  14.         $this->router->connect('/protected/:controller/:action/*', array('controller' => 'users', 'action' => 'index', 'prefix' => 'protected'));
  15.  
  16.         // User link
  17.         $this->router->connect('/:User/:controller/:action/*', array('controller'=> 'users''action' => 'index', 'prefix' => 'public'),array('User' => '~\w+'));
  18.  
  19.         $this->router->setRequestInfo(array(
  20.             array('controller' => 'users', 'action' => 'public_index', 'form' => array(), 'url' => array('url' => '~Jippi'), 'bare' => 0, 'webservices' => null, 'plugin' => null, 'User' => '~Jippi', 'prefix' => 'public'),
  21.             array('base' => '/', 'here' => '/~Jippi', 'webroot' => '/base/', 'passedArgs' => array(), 'argSeparator' => ':', 'namedArgs' => array(), 'webservices' => null)
  22.         ));
  23.  
  24.         $result = $this->router->url(array('action' => 'view'));
  25.         $expected = '/~Jippi/users/view';
  26.         $this->assertEqual($result, $expected);
  27.  
  28.         // See http://new.guu.dk/~Jippi
  29.     }
Parsed in 0.155 seconds, using GeSHi 1.0.7.14

Modify this Paste