public function testSubRoutesRetunsArray()
 {
     $kernel = new ControllerKernel();
     $this->assertInternalType('array', $kernel->subRouteTo());
 }
Beispiel #2
0
 /**
  * Capture and view model responses and insert them into the layout
  *
  * @param $response
  * @param $capturedOutput
  *
  * @return Response|null
  */
 public function handleResponse($response, $capturedOutput)
 {
     $response = $this->_sanitizeResponse($response);
     if ($response instanceof RenderableInterface) {
         if ($this->isLayoutDisabled()) {
             return $response;
         }
         $this->layout()->insert($this->_contentName, $response);
         return new Response($this->layout());
     }
     //Convert captured responses into renderable content objects
     if ($response === null) {
         if ($this->isLayoutDisabled()) {
             return new Renderable($capturedOutput);
         }
         $this->layout()->insert($this->_contentName, new Renderable($capturedOutput));
         return new Response($this->layout());
     }
     //Scalars should be assumed as content, and converted to renderables
     if (is_scalar($response)) {
         if ($this->isLayoutDisabled()) {
             return new Renderable($response);
         }
         $this->layout()->insert($this->_contentName, new Renderable($response));
         return new Response($this->layout());
     }
     //Let the kernel pickup any unhandled responses
     return parent::handleResponse($response, $capturedOutput);
 }