/** * @covers Piccolo\Templating\TemplatingModule::configureDependencyInjection */ public function testConfigureDependencyInjectionJSONEngine() { //setup $module = new TemplatingModule(); $globalConfiguration = [$module->getModuleKey() => ['engines' => [JSONMockTemplateEngine::class]]]; $dic = new DependencyInjectionContainerMock(); //act $module->configureDependencyInjection($dic, $globalConfiguration[$module->getModuleKey()], $globalConfiguration); //assert $classParams = $dic->getClassParameters(); $this->assertCount(1, $classParams[TemplateRenderingChain::class]['templateEngines']); $this->assertInstanceOf(JSONMockTemplateEngine::class, $classParams[TemplateRenderingChain::class]['templateEngines'][0]); }
/** * @covers Piccolo\Templating\Engine\Twig\TwigTemplatingModule::configureDependencyInjection */ public function testConfigureDependencyInjection() { //setup $module = new TwigTemplatingModule(); $templatingModule = new TemplatingModule(); $dic = new DependencyInjectionContainerMock(); $globalConfiguration = [$module->getModuleKey() => [], $templatingModule->getModuleKey() => []]; $module->addRequiredModule($templatingModule); //act $module->configureDependencyInjection($dic, $globalConfiguration[$module->getModuleKey()], $globalConfiguration); //assert $this->assertEquals([TemplateEngine::class => TwigTemplateEngine::class], $dic->getAliases()); }