Ejemplo n.º 1
0
 /**
  * @param \Janeiro\Request\AbstractRequest $request
  * @template Schema/Index.txt
  */
 public function indexAction(AbstractRequest $request)
 {
     if ($request->getParameter(1)) {
         $this->dispatcher->forward(['action' => $request->getParameter(1)]);
     } else {
         echo $this->view->render();
     }
 }
Ejemplo n.º 2
0
 /**
  * @template Index.txt
  * @param \Janeiro\Request\Cli $request
  */
 public function indexAction(Cli $request)
 {
     if ($request->getParameter(0)) {
         $this->dispatcher->forward(['controller' => $request->getParameter(0)]);
     } else {
         echo $this->view->render();
     }
 }
Ejemplo n.º 3
0
 public function testViewPassthrough()
 {
     $this->container['view']->registerEngine('Janeiro\\Mvc\\View\\Passthrough', ['.txt']);
     $this->container['router']->addRoute('/(.*)', ['module' => 'test', 'controller' => 'view', 'action' => 'passthrough']);
     $dispatcher = new Dispatcher($this->container);
     $dispatcher->dispatch(new Request());
     $this->assertEquals('yes sir or madam', $dispatcher->getResponse()->getContent());
 }
Ejemplo n.º 4
0
 public function testParameterRequest()
 {
     $request = new Request();
     $request->set(['test', 'parameter', 'variable', '123']);
     $this->assertEquals('variable is 123', $this->dispatcher->dispatch($request)->getContent());
 }