mirror of
https://github.com/composer/composer
synced 2025-05-09 00:22:53 +00:00
Correctly merge boolean flag of allow-plugin config (#10909)
This commit is contained in:
parent
a5fdc00de1
commit
424547bb70
2 changed files with 32 additions and 7 deletions
|
@ -371,4 +371,34 @@ class ConfigTest extends TestCase
|
|||
|
||||
$this->assertEquals('COMPOSER_HTACCESS_PROTECT', $result);
|
||||
}
|
||||
|
||||
public function testMergesPluginConfig()
|
||||
{
|
||||
$config = new Config(false);
|
||||
$config->merge(array('config' => array('allow-plugins' => array('some/plugin' => true))));
|
||||
$this->assertEquals(array('some/plugin' => true), $config->get('allow-plugins'));
|
||||
|
||||
$config->merge(array('config' => array('allow-plugins' => array('another/plugin' => true))));
|
||||
$this->assertEquals(array('some/plugin' => true, 'another/plugin' => true), $config->get('allow-plugins'));
|
||||
}
|
||||
|
||||
public function testOverridesGlobalBooleanPluginsConfig()
|
||||
{
|
||||
$config = new Config(false);
|
||||
$config->merge(array('config' => array('allow-plugins' => true)));
|
||||
$this->assertEquals(true, $config->get('allow-plugins'));
|
||||
|
||||
$config->merge(array('config' => array('allow-plugins' => array('another/plugin' => true))));
|
||||
$this->assertEquals(array('another/plugin' => true), $config->get('allow-plugins'));
|
||||
}
|
||||
|
||||
public function testAllowsAllPluginsFromLocalBoolean()
|
||||
{
|
||||
$config = new Config(false);
|
||||
$config->merge(array('config' => array('allow-plugins' => array('some/plugin' => true))));
|
||||
$this->assertEquals(array('some/plugin' => true), $config->get('allow-plugins'));
|
||||
|
||||
$config->merge(array('config' => array('allow-plugins' => true)));
|
||||
$this->assertEquals(true, $config->get('allow-plugins'));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue