/** * Tests the installation with a custom files and images directory. */ public function testInstallationWithCustomPaths() { $container = new ContainerBuilder(); $container->setParameter('kernel.root_dir', $this->getRootDir() . '/app'); $container->setParameter('contao.upload_path', 'files_test'); $container->setParameter('contao.image.target_path', 'assets/images_test'); $command = new InstallCommand('contao:install'); $command->setContainer($container); $tester = new CommandTester($command); $code = $tester->execute([]); $this->assertEquals(0, $code); $this->assertContains('Created the ' . $this->getRootDir() . '/files_test directory.', $tester->getDisplay()); $this->assertContains('Added the ' . $this->getRootDir() . '/assets/images_test/.gitignore file.', $tester->getDisplay()); }
/** * Tests the output. */ public function testOutput() { $command = new InstallCommand('contao:install'); $tester = new CommandTester($command); $container = new ContainerBuilder(); $container->setParameter('kernel.root_dir', $this->getRootDir() . '/app'); $command->setContainer($container); $code = $tester->execute([]); $this->assertEquals(0, $code); $this->assertContains('Created the ' . $this->getRootDir() . '/files directory.', $tester->getDisplay()); $this->assertContains('Created the ' . $this->getRootDir() . '/templates directory.', $tester->getDisplay()); $this->assertContains('Created the ' . $this->getRootDir() . '/web/system directory.', $tester->getDisplay()); $this->assertContains('Added the ' . $this->getRootDir() . '/assets/css/.gitignore file.', $tester->getDisplay()); $this->assertContains('Added the ' . $this->getRootDir() . '/assets/images/.gitignore file.', $tester->getDisplay()); $this->assertContains('Added the ' . $this->getRootDir() . '/assets/js/.gitignore file.', $tester->getDisplay()); $this->assertContains('Added the ' . $this->getRootDir() . '/system/cache/.gitignore file.', $tester->getDisplay()); $this->assertContains('Added the ' . $this->getRootDir() . '/system/config/.gitignore file.', $tester->getDisplay()); $this->assertContains('Added the ' . $this->getRootDir() . '/system/themes/.gitignore file.', $tester->getDisplay()); $this->assertContains('Added the ' . $this->getRootDir() . '/system/tmp/.gitignore file.', $tester->getDisplay()); }
/** * Runs the post install commands. */ private function runPostInstallCommands() { $rootDir = $this->container->getParameter('kernel.root_dir'); if (is_dir($rootDir . '/../files') && is_link($rootDir . '/../web/assets')) { return; } // Install the bundle assets $command = new AssetsInstallCommand(); $command->setContainer($this->container); $command->run(new ArgvInput(['assets:install', '--relative', $rootDir . '/../web']), new NullOutput()); // Add the Contao directories $command = new InstallCommand(); $command->setContainer($this->container); $command->run(new ArgvInput([]), new NullOutput()); // Generate the symlinks $command = new SymlinksCommand(); $command->setContainer($this->container); $command->run(new ArgvInput([]), new NullOutput()); }