示例#1
0
 public function testGetNamed()
 {
     $route = new Route(['name' => 'hello']);
     $dispatcher = new Dispatcher(new Request());
     $dispatcher->addRoute($route);
     $this->assertEquals($route, $dispatcher->getNamed('hello'));
 }
示例#2
0
文件: CMS.php 项目: gudwin/extasy
 protected function processSecurity()
 {
     $this->auth = CMSAuth::getInstance();
     // ignore security settings in command line mode
     if ($this->dispatcher->getRequest() instanceof \Faid\Request\CommandLineRequest) {
         return;
     }
     if (self::isUnitTestsRunning()) {
         return;
     }
     \Trace::addMessage('CMS', 'Проверка безопасности');
     if ($this->dispatcher->getRequest() instanceof Request) {
         $this->dispatcher->getRequest()->testForInjections();
         $this->dispatchGranted = $this->showAuthScreenIfNecessary();
     }
     \Extasy\Audit\DDosDetector::detect();
 }
示例#3
0
 public function testGetRequest()
 {
     $request = new Request(array('phrase1' => 'Hello', 'phrase2' => 'World'));
     $dispatcher = new Dispatcher($request);
     $this->assertEquals($request, $dispatcher->getRequest());
 }
示例#4
0
文件: routeTest.php 项目: gudwin/faid
 public function testControllerMethodsCalled()
 {
     $request = new HttpRequest();
     $request->uri('/Controller/test/');
     $dispatcher = new Dispatcher($request);
     $dispatcher->addRoute(new HttpRoute(array('url' => '/Controller/test', 'controller' => '\\Faid\\tests\\Dispatcher\\testController', 'action' => 'someAction')));
     $route = $dispatcher->run();
     //
     $this->assertEquals(testController::getBeforeActionCalled(), false);
     $this->assertEquals(testController::getCalled(), false);
     //
     $route->dispatch();
     //
     $this->assertEquals(testController::getBeforeActionCalled(), true);
     $this->assertEquals(testController::getCalled(), true);
 }