Esempio n. 1
0
 public function testDispatchScript()
 {
     $route = new Route();
     $request = new HttpRequest();
     $request->uri(self::scriptUrlFixture);
     $this->assertTrue($route->test($request));
     $this->assertFalse(self::$sitemapScriptCalledFlag);
     $route->dispatch();
     $this->assertTrue(self::$sitemapScriptCalledFlag);
 }
Esempio n. 2
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);
 }