/** * Warm up _layoutRootPaths_ of the provided RenderingContext's * TemplatePaths instance. Simple, recursive processing of all * supported format template files in path(s), compiling only * the topmost (override) template file if the same template * exists in multiple layout root paths. * * Like other methods, returns a FluidCacheWarmupResult instance * which can be merged with other result instances. * * @param RenderingContextInterface $renderingContext * @return FluidCacheWarmupResult */ protected function warmupLayoutRootPaths(RenderingContextInterface $renderingContext) { $result = new FluidCacheWarmupResult(); $paths = $renderingContext->getTemplatePaths(); foreach ($this->formats as $format) { foreach ($paths->resolveAvailableLayoutFiles($format) as $layoutFile) { $paths->setFormat($format); $state = $this->warmSingleFile($layoutFile, $paths->getLayoutIdentifier(basename($layoutFile, '.' . $layoutFile)), $renderingContext); $result->add($state, $layoutFile); } } return $result; }
/** * @param ParsedTemplateInterface $subject * @param array $expected * @dataProvider getAddTestValues * @test */ public function testAdd(ParsedTemplateInterface $subject, array $expected) { $result = new FluidCacheWarmupResult(); $result->add($subject, 'foobar'); $this->assertAttributeEquals(['foobar' => $expected], 'results', $result); }