/** * @covers ::addView() * @covers ::body() * @covers ::template() * @covers ::clear() * @covers \Arvici\Component\View\Render */ public function testInvalidBody() { $this->clearBuilder(); $this->builder->defaultStack(); try { Render::getInstance()->body(new View('invalid', View::PART_TEMPLATE)); $this->assertTrue(false); } catch (RendererException $re) { $this->assertTrue(true); } $this->builder->clear(); try { Render::getInstance()->body(new View('valid_but_no_body_placeholder', View::PART_BODY)); $this->assertTrue(false); } catch (RendererException $re) { $this->assertTrue(true); } }
/** * Render now. Should be used by the response object. * @param array $data Set additional data for all views. * @param bool $return Return the output instead of writing. * * @return mixed|void */ public function render($data = array(), $return = false) { $this->render->setGlobalData(array_merge($this->globalData, $data)); return $this->render->run($return); }