public function setUp() { TemplateEngine::setConfig(__DIR__ . '/ExampleConfig.yaml'); }
public function setUp() { // make sure we unregister the class loader map, can cause a conflict with the composer ClassLoader::getInstance()->unregisterMap('Smarty_'); TemplateEngine::setConfig(__DIR__ . '/../../ExampleConfig.yaml'); }
public function setUp() { \Webiny\Component\TemplateEngine\TemplateEngine::setConfig(__DIR__ . '/../ExampleConfig.yaml'); }
/** * Returns template engine instance, based on current configuration. * If a template engine is not defined, a default template engine instance will be created. * * @return \Webiny\Component\TemplateEngine\Bridge\TemplateEngineInterface * @throws \Exception * @throws \Webiny\Component\StdLib\Exception\Exception * @throws \Webiny\Component\TemplateEngine\TemplateEngineException */ private function getTemplateEngineInstance() { $teConfig = $this->getComponentConfig('TemplateEngine', 'Engines', false); // fallback to default template engine if (!$teConfig) { $defaultTemplateEngineConfig = ['Engines' => ['Smarty' => ['ForceCompile' => false, 'CacheDir' => $this->getAbsolutePath() . 'App/Cache/Smarty/Cache', 'CompileDir' => $this->getAbsolutePath() . 'App/Cache/Smarty/Compile', 'TemplateDir' => $this->getAbsolutePath() . 'App/Layouts', 'AutoEscapeOutput' => false]]]; TemplateEngine::setConfig(new ConfigObject($defaultTemplateEngineConfig)); return TemplateEngineLoader::getInstance('Smarty'); } $teConfig = $this->getComponentConfig('TemplateEngine', 'Engines')->toArray(); reset($teConfig); $teName = key($teConfig); return TemplateEngineLoader::getInstance($teName); }