/** * Verifies that we can create a cached application. * * @runInSeparateProcess */ public function testCreateCached() { // create a test configuration file file_put_contents($this->dir . '/box.yml', Yaml::dump(array('parameters' => array('box.console.name' => 'Box', 'box.console.version' => '0.0.0')))); // create the cacheable app $app = Application::create($this->dir); // verify the cache is created self::assertFileExists($this->dir . '/.box/BoxContainer.php'); // make sure the container is properly set up /** @var ContainerBuilder $container */ $container = $app->getContainer(); self::assertInstanceOf('Symfony\\Component\\DependencyInjection\\ContainerBuilder', $container); self::assertEquals('Box', $container->getParameter('box.console.name')); self::assertTrue($container->hasExtension('box')); // load the cached app $app = Application::create($this->dir); // make sure it's the cached app self::assertFalse($app->getContainer() instanceof ContainerBuilder); }
/** * Creates the application. * * @param null|string $dir The project directory path. * * @return Application The new application. */ protected function createApp($dir = null) { $app = Application::create($dir); $app->getContainer()->get('box.console')->setAutoExit(false); return $app; }