/** * Tests the isOptional() method. */ public function testIsOptional() { $this->assertTrue($this->warmer->isOptional()); }
/** * Generate the internal cache */ public function generateInternalCache() { $container = \System::getContainer(); $command = new ContaoCacheWarmer($container->get('filesystem'), $container->get('contao.resource_finder'), $container->get('contao.resource_locator'), $container->getParameter('kernel.root_dir'), $container->get('database_connection'), $container->get('contao.framework')); $command->warmUp(\System::getContainer()->getParameter('kernel.cache_dir')); // Add a log entry $this->log('Generated the internal cache', __METHOD__, TL_CRON); }
/** * Tests that no cache is created if the installation is incomplete. */ public function testIncompleteInstallation() { /** @var Connection|\PHPUnit_Framework_MockObject_MockObject $connection */ $connection = $this->getMock('Doctrine\\DBAL\\Connection', ['query'], [], '', false); $connection->expects($this->any())->method('query')->willThrowException(new \Exception()); $framework = $this->getMockBuilder('Contao\\CoreBundle\\Framework\\ContaoFramework')->setMethods(['initialize'])->disableOriginalConstructor()->getMock(); $framework->expects($this->never())->method('initialize'); $warmer = new ContaoCacheWarmer(new Filesystem(), new ResourceFinder($this->getRootDir() . '/vendor/contao/test-bundle/Resources/contao'), new FileLocator($this->getRootDir() . '/vendor/contao/test-bundle/Resources/contao'), $this->getRootDir() . '/vendor/contao/test-bundle/Resources/contao', $connection, $framework); $warmer->warmUp($this->getCacheDir()); $this->assertFileNotExists($this->getCacheDir() . '/contao'); }