Add config.json default config option for "disable-tls" (FALSE by default)
parent
aa74818fe0
commit
7e30c67827
|
@ -39,6 +39,7 @@ class Config
|
|||
'optimize-autoloader' => false,
|
||||
'prepend-autoloader' => true,
|
||||
'github-domains' => array('github.com'),
|
||||
'disable-tls' => false
|
||||
);
|
||||
|
||||
public static $defaultRepositories = array(
|
||||
|
@ -210,6 +211,9 @@ class Config
|
|||
}
|
||||
|
||||
return $this->config[$key];
|
||||
|
||||
case 'disable-tls':
|
||||
return $this->config[$key]!== 'false' && (bool) $this->config[$key];
|
||||
|
||||
default:
|
||||
if (!isset($this->config[$key])) {
|
||||
|
|
|
@ -117,4 +117,20 @@ class ConfigTest extends \PHPUnit_Framework_TestCase
|
|||
|
||||
$this->assertEquals(array('https'), $config->get('github-protocols'));
|
||||
}
|
||||
|
||||
/**
|
||||
* @group TLS
|
||||
*/
|
||||
public function testDisableTlsCanBeOverridden()
|
||||
{
|
||||
$config = new Config;
|
||||
$config->merge(
|
||||
array('config' => array('disable-tls' => 'false'))
|
||||
);
|
||||
$this->assertFalse($config->get('disable-tls'));
|
||||
$config->merge(
|
||||
array('config' => array('disable-tls' => 'true'))
|
||||
);
|
||||
$this->assertTrue($config->get('disable-tls'));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,28 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Composer.
|
||||
*
|
||||
* (c) Nils Adermann <naderman@naderman.de>
|
||||
* Jordi Boggiano <j.boggiano@seld.be>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Composer\Test;
|
||||
|
||||
use Composer\Config;
|
||||
|
||||
class DefaultConfigTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
/**
|
||||
* @group TLS
|
||||
*/
|
||||
public function testDefaultValuesAreAsExpected()
|
||||
{
|
||||
$config = new Config;
|
||||
$this->assertFalse($config->get('disable-tls'));
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue