/** * Register XSL templates for Silex microframework * * @param \Silex\Application|\SilexXSLTemplate\Application $app */ public function register(Application $app) { $app['xsltemplate'] = $app->share(function () use($app) { $renderer = new Renderer(); if (isset($app['xsltemplate.parameters'])) { $renderer->addParameters($app['xsltemplate.parameters']); } if (isset($app['xsltemplate.templates.path'])) { $renderer->addParameters(array('templates.path' => $app['xsltemplate.templates.path'])); } if (isset($app['xsltemplate.templates.url'])) { $renderer->addParameters(array('templates.url' => $app['xsltemplate.templates.url'])); } if (isset($app['xsltemplate.configure'])) { $app['xsltemplate.configure']($renderer); } return $renderer; }); $app['xsltemplate.writer'] = $app->share(function () use($app) { $writer = new Writer(); $writer->init(); return $writer; }); }
/** * Test for exceptions from render without render.types parameters * @expectedException \DomainException * @expectedExceptionMessage render.types is not defined in renderer parameters */ public function testExceptionFromRenderWithoutTypes() { $this->_sut->setParameters(array()); $this->_sut->render('test', new \XSLTemplate\XML\Writer()); }