Inheritance: extends lithium\action\Dispatcher
 public function testRun()
 {
     Router::connect('/', array('controller' => 'test', 'action' => 'test'));
     $request = new Request();
     $request->url = '/';
     MockDispatcher::run($request);
     $result = end(MockDispatcher::$dispatched);
     $expected = array('controller' => 'test', 'action' => 'test');
     $this->assertEqual($expected, $result->params);
 }
示例#2
0
 public function testAutoHandler()
 {
     $result = MockDispatcher::run(new Request(array('url' => '/auto')));
     $this->assertEqual(array('location: /redirect'), $result->headers());
 }
示例#3
0
 public function testMatchWithScopeAndWithoutController()
 {
     Router::scope('app', function () {
         Router::connect('/{:id}', 'Posts::index');
     });
     $request = new Request(array('url' => '/1', 'base' => ''));
     MockDispatcher::run($request);
     $result = Router::match(array('id' => 2), $request);
     $this->assertEqual('/2', $result);
 }