Beispiel #1
0
 public function testGetNamed()
 {
     $route = new Route(['name' => 'hello']);
     $dispatcher = new Dispatcher(new Request());
     $dispatcher->addRoute($route);
     $this->assertEquals($route, $dispatcher->getNamed('hello'));
 }
Beispiel #2
0
 protected function initializeRoutes()
 {
     include __DIR__ . DIRECTORY_SEPARATOR . 'dashboard_routes.php';
     $mainDomain = self::getMainDomain();
     $this->dispatcher->addRoute(new sitemapRoute());
     $this->dispatcher->addRoute(new HttpRoute(array('url' => $mainDomain . '/api/', 'controller' => '\\Extasy\\Api\\ApiController', 'action' => 'process')));
     $this->dispatcher->addRoute(new HttpRoute(array('url' => 'http://Service/schedule/', 'controller' => '\\Extasy\\Schedule\\Runner', 'action' => 'resolveJobs')));
 }
Beispiel #3
0
 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);
 }