/** * Tests the output. */ public function testOutput() { $container = new ContainerBuilder(); $container->setParameter('kernel.root_dir', $this->getRootDir() . '/app'); $container->setParameter('kernel.logs_dir', $this->getRootDir() . '/var/logs'); $container->setParameter('contao.upload_path', 'app'); $container->set('contao.resource_finder', new ResourceFinder($this->getRootDir() . '/vendor/contao/test-bundle/Resources/contao')); $command = new SymlinksCommand('contao:symlinks'); $command->setContainer($container); $tester = new CommandTester($command); $code = $tester->execute([]); $display = $tester->getDisplay(); $this->assertEquals(0, $code); $this->assertContains('web/system/modules/foobar/assets', $display); $this->assertContains('system/modules/foobar/assets', $display); $this->assertContains('web/system/modules/foobar/html', $display); $this->assertContains('system/modules/foobar/html', $display); $this->assertContains('web/system/modules/foobar/html/foo', $display); $this->assertContains('Skipped because system/modules/foobar/html will be symlinked.', $display); $this->assertContains('system/themes/flexible', $display); $this->assertContains('vendor/contao/test-bundle/Resources/contao/themes/flexible', $display); $this->assertContains('web/assets', $display); $this->assertContains('assets', $display); $this->assertContains('web/system/themes', $display); $this->assertContains('system/themes', $display); $this->assertContains('system/logs', $display); $this->assertContains('var/logs', $display); }
/** * Tests the output. */ public function testOutput() { $container = new ContainerBuilder(); $container->setParameter('kernel.root_dir', $this->getRootDir() . '/app'); $container->setParameter('contao.upload_path', 'app'); $container->set('contao.resource_finder', new ResourceFinder($this->getRootDir() . '/vendor/contao/test-bundle/Resources/contao')); $command = new SymlinksCommand('contao:symlinks'); $command->setContainer($container); $tester = new CommandTester($command); $code = $tester->execute([]); $expected = <<<EOF Added web/system/modules/foobar/assets as symlink to system/modules/foobar/assets. Added web/system/modules/foobar/html as symlink to system/modules/foobar/html. Skipped system/modules/foobar/html/foo because system/modules/foobar/html has been symlinked already. Added system/themes/flexible as symlink to vendor/contao/test-bundle/Resources/contao/themes/flexible. Added web/assets as symlink to assets. Added web/system/themes as symlink to system/themes. Added system/logs as symlink to app/logs. EOF; $this->assertEquals(0, $code); $this->assertEquals($expected, str_replace("\r", '', $tester->getDisplay())); }
/** * Generate the symlinks in the web/ folder */ public function generateSymlinks() { $container = \System::getContainer(); $command = new SymlinksCommand(); $command->setContainer($container); $command->run(new ArgvInput(array()), new NullOutput()); }
/** * 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()); }
/** * Generate the symlinks in the web/ folder */ public function generateSymlinks() { $command = new SymlinksCommand(); $command->setContainer(\System::getContainer()); $status = $command->run(new ArgvInput(array()), new NullOutput()); // Add a log entry if ($status > 0) { $this->log('The symlinks could not be regenerated', __METHOD__, TL_ERROR); } else { $this->log('Regenerated the symlinks', __METHOD__, TL_CRON); } }