/** * @dataProvider getAddResourcesTests */ public function testAddResource($bundleName, $format, $startingContents, $expectedContents) { $bundle = new Bundle('Acme', $bundleName, 'src', $format, true); $configurationPath = $this->tmpDir . '/config.yml'; file_put_contents($configurationPath, $startingContents); $manipulator = new ConfigurationManipulator($configurationPath); $manipulator->addResource($bundle); $realContents = file_get_contents($configurationPath); $this->assertEquals($expectedContents, $realContents); }
protected function updateConfiguration(OutputInterface $output, Bundle $bundle) { $targetConfigurationPath = $this->getContainer()->getParameter('kernel.root_dir') . '/config/config.yml'; $output->write(sprintf('> Importing the bundle\'s %s from the <info>%s</info> file: ', $bundle->getServicesConfigurationFilename(), $this->makePathRelative($targetConfigurationPath))); $manipulator = new ConfigurationManipulator($targetConfigurationPath); try { $manipulator->addResource($bundle); } catch (\RuntimeException $e) { return array('- Import the bundle\'s %s resource in the app\'s main configuration file:', '', $manipulator->getImportCode($bundle), ''); } }