prefer strings for install handling when possible
parent
124739d055
commit
73c1f8c0e0
|
@ -113,6 +113,7 @@ class Config
|
||||||
if (in_array($key, array('github-oauth', 'http-basic')) && isset($this->config[$key])) {
|
if (in_array($key, array('github-oauth', 'http-basic')) && isset($this->config[$key])) {
|
||||||
$this->config[$key] = array_merge($this->config[$key], $val);
|
$this->config[$key] = array_merge($this->config[$key], $val);
|
||||||
} elseif ('preferred-install' === $key && isset($this->config[$key])) {
|
} elseif ('preferred-install' === $key && isset($this->config[$key])) {
|
||||||
|
if (is_array($val) || is_array($this->config[$key])) {
|
||||||
if (is_string($val)) {
|
if (is_string($val)) {
|
||||||
$val = array('*' => $val);
|
$val = array('*' => $val);
|
||||||
}
|
}
|
||||||
|
@ -129,6 +130,9 @@ class Config
|
||||||
} else {
|
} else {
|
||||||
$this->config[$key] = $val;
|
$this->config[$key] = $val;
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
$this->config[$key] = $val;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -116,8 +116,9 @@ class ConfigTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
$config = new Config(false);
|
$config = new Config(false);
|
||||||
$config->merge(array('config' => array('preferred-install' => 'source')));
|
$config->merge(array('config' => array('preferred-install' => 'source')));
|
||||||
|
$config->merge(array('config' => array('preferred-install' => 'dist')));
|
||||||
|
|
||||||
$this->assertEquals(array('*' => 'source'), $config->get('preferred-install'));
|
$this->assertEquals('dist', $config->get('preferred-install'));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testMergePreferredInstall()
|
public function testMergePreferredInstall()
|
||||||
|
|
Loading…
Reference in New Issue