/** * @expectedException \Symfony\Component\Filesystem\Exception\FileNotFoundException * @expectedExceptionMessage File "/i/dont/exist" could not be found. */ public function testAddInvalidPath() { $profiler = new Profiler(); $finder = $this->getMock(TemplateFinderInterface::class); $fixture_path = realpath(__DIR__ . '/../../Fixture'); $tracker = new Tracker($profiler, $finder, $fixture_path . '/cache', $fixture_path, []); $tracker->addPath("/i/dont/exist"); }
public function testRequestCompile() { $this->tracker->expects($this->once())->method('isOutdated')->willReturn(true); $this->compiler->expects($this->once())->method('compile'); $this->dumper->expects($this->once())->method('dump'); $this->event->expects($this->once())->method('isMasterRequest')->willReturn(true); (new RequestListener($this->tracker, $this->compiler, $this->dumper))->onRequest($this->event); }
/** * @param GetResponseEvent $event */ public function onRequest(GetResponseEvent $event) { if (!$event->isMasterRequest()) { return; } if ($this->tracker->isOutdated()) { $this->compiler->compile(); } $this->dumper->dump(new Filesystem()); }
/** * Rebuild the cache, check to see if it's still valid and rebuild if it's outdated. */ public function rebuild() { if ($this->tracker->isOutdated()) { $this->logger->info('[Webpack 1/2]: Compiling assets.'); $output = $this->compiler->compile(); $this->logger->debug($output); $this->logger->info('[Webpack 2/2]: Dumping assets.'); $this->dumper->dump(); } else { $this->logger->info('[Webpack]: Cache still up-to-date.'); } }
/** * 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 addPath for invalid path. * * @expectedException \Symfony\Component\Filesystem\Exception\FileNotFoundException * @expectedExceptionMessage File "/i/dont/exist" could not be found. */ public function testAddInvalidPath() { $profiler = new Profiler(); $finder = $this->getMockBuilder(TemplateFinderInterface::class)->getMock(); $tracker = new Tracker($profiler, $finder, $this->root_dir, $this->asset_dir, $this->output_dir, []); $tracker->addPath("/i/dont/exist"); }