public function testCreateConfigWithExistingHomeAndLocalConfig()
{
$content = <<<EOT
adapters:
github:
config: { base_url: 'https://api.github.com/', repo_domain_url: 'https://github.com' }
authentication: { username: cordoval, password-or-token: password, http-auth-type: http_password }
EOT;
file_put_contents($this->homedir . '/.gush.yml', $content);
$localContent = <<<EOT
repo_adapter: bitbucket
EOT;
$localDir = $this->getNewTmpDirectory('gush-local');
file_put_contents($localDir . '/.gush.yml', $localContent);
$config = ConfigFactory::createConfig($localDir);
$this->assertEquals(['adapters' => ['github' => ['config' => ['base_url' => 'https://api.github.com/', 'repo_domain_url' => 'https://github.com'], 'authentication' => ['username' => 'cordoval', 'password-or-token' => 'password', 'http-auth-type' => 'http_password']]], 'repo_adapter' => 'bitbucket', 'home' => $this->homedir, 'home_config' => $this->homedir . '/.gush.yml', 'local' => $localDir, 'local_config' => $localDir . '/.gush.yml'], $config->toArray(Config::CONFIG_ALL));
$this->assertEquals(['adapters' => ['github' => ['config' => ['base_url' => 'https://api.github.com/', 'repo_domain_url' => 'https://github.com'], 'authentication' => ['username' => 'cordoval', 'password-or-token' => 'password', 'http-auth-type' => 'http_password']]]], $config->toArray(Config::CONFIG_SYSTEM));
$this->assertEquals(['repo_adapter' => 'bitbucket'], $config->toArray(Config::CONFIG_LOCAL));
}