1
0
Fork 0
mirror of https://github.com/composer/composer synced 2025-05-10 17:12:51 +00:00

Config: add source option for command to show where a config value is loaded from (#10129)

This commit is contained in:
Stephan 2021-11-11 14:17:58 +00:00 committed by GitHub
parent 012556daee
commit 44c5b6cde6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 113 additions and 17 deletions

View file

@ -340,4 +340,26 @@ class ConfigTest extends TestCase
$this->assertEquals(0, $config->get('htaccess-protect'));
putenv('COMPOSER_HTACCESS_PROTECT');
}
public function testGetSourceOfValue()
{
$config = new Config;
$this->assertSame(Config::SOURCE_DEFAULT, $config->getSourceOfValue('process-timeout'));
$config->merge(
array('config' => array('process-timeout' => 1)),
'phpunit-test'
);
$this->assertSame('phpunit-test', $config->getSourceOfValue('process-timeout'));
}
public function testGetSourceOfValueEnvVariables()
{
putenv('COMPOSER_HTACCESS_PROTECT=0');
$config = new Config;
$this->assertEquals('COMPOSER_HTACCESS_PROTECT', $config->getSourceOfValue('htaccess-protect'));
putenv('COMPOSER_HTACCESS_PROTECT');
}
}