public function testGetNamed() { $route = new Route(['name' => 'hello']); $dispatcher = new Dispatcher(new Request()); $dispatcher->addRoute($route); $this->assertEquals($route, $dispatcher->getNamed('hello')); }
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(); }
public function testGetRequest() { $request = new Request(array('phrase1' => 'Hello', 'phrase2' => 'World')); $dispatcher = new Dispatcher($request); $this->assertEquals($request, $dispatcher->getRequest()); }
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); }