Пример #1
0
 public function render()
 {
     $layout = $this->content_for_template();
     $body = $this->content_for_layout($layout);
     // Needed for testing
     if (CUPCAKE_ENV === "test") {
         $dispatcher = DispatcherTest::getInstance();
         $dispatcher->__params = $this->view_params();
         $dispatcher->__view_params = $this->view_params;
         $dispatcher->__template = $this->template;
         $dispatcher->__layout = $this->layout;
         # Action might be false positive and controller aswell.
         $dispatcher->__controller = $this->controller;
         $dispatcher->__action = $this->params["action"];
         $dispatcher->__request_uri = $this->request_uri;
         $dispatcher->__body = $body;
         return;
     }
     if (!empty($this->content_type)) {
         Header::set("Content-Type", $this->content_type);
         Header::send();
     }
     echo $body;
     exit;
 }
Пример #2
0
 public function make_request($request_uri)
 {
     $_SERVER['REQUEST_URI'] = $request_uri;
     $this->dispatcher = DispatcherTest::getInstance();
     DispatcherTest::run();
 }