Example #1
0
 /**
  * @param $path string
  * @param $action callable|string
  */
 public static function post($path, $action)
 {
     $route = new Route();
     $route->setMethod("GET");
     $route->setPath($path);
     $route->setAction($action);
     self::addRoute($route);
 }
 public function testInvoke_Failing()
 {
     $route = new Route();
     $route->setAction('sample');
     $controller = $this->createController();
     $this->setExpectedException('NotFoundHttpException');
     $this->object->invoke($controller, $route);
 }
Example #3
0
 /**
  * @dataProvider getSetProvider
  * @covers Route::getController
  * @covers Route::setController
  * @covers Route::getAction
  * @covers Route::setAction
  * @covers Route::getParams
  * @covers Route::setParams
  *
  * @param string $controller
  * @param string $action
  * @param array $params
  */
 public function testGetSet($controller, $action, array $params)
 {
     $route = new Route('a', 'b', array('c'));
     $route->setController($controller);
     $this->assertEquals($controller, $route->getController());
     $route->setAction($action);
     $this->assertEquals($action, $route->getAction());
     $route->setParams($params);
     $this->assertEquals($params, $route->getParams());
 }
 public function testSetAction()
 {
     $this->object->setAction('someAction');
     $this->assertEquals('someAction', $this->object->getAction());
 }