protected function setUp() { $this->tempDir = sys_get_temp_dir(); $baseDir = $this->tempDir . Script::getPlatformSubdir(); if (!file_exists($baseDir)) { mkdir($baseDir, 0777, true); } $defaultCfg['parameters'] = ['oneParam' => 'defaultValue']; $dest = $baseDir . 'default.yml'; file_put_contents($dest, \Symfony\Component\Yaml\Yaml::dump($defaultCfg)); $this->generated = $baseDir . php_uname('n') . '.yml'; // make sure old tests are deleted if (file_exists($this->generated)) { unlink($this->generated); } }
/** * Loading the config for the current evironment * and importing platform-specific parameters depending of computer's name * * With this system you can store/commit/track (or not with .gitignore) every change in * every config on every computer. Reduce the rate of "But it works on my computer !" * * I prefer this system than one from Incenteev but you can mix both * * @param \Symfony\Component\Config\Loader\LoaderInterface $loader */ public function registerContainerConfiguration(LoaderInterface $loader) { $loader->load($this->rootDir . '/config/config_' . $this->getEnvironment() . '.yml'); $loader->import($this->rootDir . Script::getPlatformSubdir() . Script::getPlatformName() . '.yml'); }