/** * Add split points to the 'entry' section of the configuration. */ private function addSplitPoints() { $split_points = []; foreach ($this->tracker->getTemplates() as $template_file) { $split_points = array_merge($split_points, $this->twig_parser->findSplitPoints($template_file)); } foreach ($split_points as $id => $file) { $this->generator->addBlock((new CodeBlock())->set(CodeBlock::ENTRY, [self::getAliasId($id) => $file])); } }
/** * test the getTempaltes function for 1 template, including duplicate call of function. */ public function testGetTemplates() { $profiler = new Profiler(); $ref = $this->prophesize(TemplateReferenceInterface::class); $ref->getPath()->willReturn('assets/base.js'); $ref->get('engine')->willReturn('twig'); $finder = $this->prophesize(TemplateFinderInterface::class); $finder->findAllTemplates()->willReturn([$ref->reveal()]); $tracker = new Tracker($profiler, $finder->reveal(), $this->root_dir, $this->asset_dir, $this->output_dir); self::assertEquals([$this->root_dir . DIRECTORY_SEPARATOR . $this->asset_dir . DIRECTORY_SEPARATOR . 'base.js'], $tracker->getTemplates()); //Calling twice results in same answer self::assertEquals([$this->root_dir . DIRECTORY_SEPARATOR . $this->asset_dir . DIRECTORY_SEPARATOR . 'base.js'], $tracker->getTemplates()); }