Пример #1
0
 /**
  *  Test recognize_route().
  *  recognize_route() sets up a lot of private variables that we
  *  don't have access to so we can't test it very thoroughly here
  */
 public function testRecognize_route()
 {
     //  read routes from config/routes.php
     $ac = new ActionController();
     //  this URL doesn't match any route
     $_SERVER['REDIRECT_URL'] = '/~haas/foo/bar';
     $this->assertFalse($ac->recognize_route());
     //  this URL matches but the controller doesn't exist
     $_SERVER['REDIRECT_URL'] = '/~haas/nocontroller/foo/bar';
     $this->assertFalse($ac->recognize_route());
     //  this URL matches and the controller is where it should be
     $_SERVER['REDIRECT_URL'] = '/~haas/products/bar';
     $this->assertTrue($ac->recognize_route());
 }