createConfig() public static method

Note that any missing config file is ignored. When the home directory doesn't exist it's created.
public static createConfig ( $home = null, string | null $localHome = null ) : Config
$localHome string | null Local home directory to load extra configuration from when null this is ignored
return Config
Ejemplo n.º 1
0
 public function testDumpConfigToLocalFile()
 {
     $localDir = $this->getNewTmpFolder('gush-local');
     $config = ConfigFactory::createConfig($localDir);
     $config->merge(['adapter' => 'bitbucket'], Config::CONFIG_LOCAL);
     $this->assertFileNotExists($localDir . '/.gush.yml');
     ConfigFactory::dumpToFile($config, Config::CONFIG_LOCAL);
     ConfigFactory::dumpToFile($config, Config::CONFIG_SYSTEM);
     $this->assertFileExists($localDir . '/.gush.yml');
     $this->assertEquals(['adapter' => 'bitbucket'], Yaml::parse(file_get_contents($localDir . '/.gush.yml')));
     ConfigFactory::dumpToFile($config, Config::CONFIG_SYSTEM);
     $this->assertFileExists($this->homedir . '/.gush.yml');
     $this->assertEquals(['adapters' => []], Yaml::parse(file_get_contents($this->homedir . '/.gush.yml')));
 }