Fix regression in handling github-oauth settings in auth.json
parent
2ed0bfc1ba
commit
7131607ad1
|
@ -125,7 +125,7 @@ class JsonManipulator
|
|||
}
|
||||
|
||||
$subName = null;
|
||||
if (false !== strpos($name, '.')) {
|
||||
if (in_array($mainNode, array('config', 'repositories')) && false !== strpos($name, '.')) {
|
||||
list($name, $subName) = explode('.', $name, 2);
|
||||
}
|
||||
|
||||
|
@ -203,7 +203,7 @@ class JsonManipulator
|
|||
}
|
||||
|
||||
$subName = null;
|
||||
if (false !== strpos($name, '.')) {
|
||||
if (in_array($mainNode, array('config', 'repositories')) && false !== strpos($name, '.')) {
|
||||
list($name, $subName) = explode('.', $name, 2);
|
||||
}
|
||||
|
||||
|
|
|
@ -735,6 +735,24 @@ class JsonManipulatorTest extends \PHPUnit_Framework_TestCase
|
|||
', $manipulator->getContents());
|
||||
}
|
||||
|
||||
public function testAddRootSettingDoesNotBreakDots()
|
||||
{
|
||||
$manipulator = new JsonManipulator('{
|
||||
"github-oauth": {
|
||||
"github.com": "foo"
|
||||
}
|
||||
}');
|
||||
|
||||
$this->assertTrue($manipulator->addSubNode('github-oauth', 'bar', 'baz'));
|
||||
$this->assertEquals('{
|
||||
"github-oauth": {
|
||||
"github.com": "foo",
|
||||
"bar": "baz"
|
||||
}
|
||||
}
|
||||
', $manipulator->getContents());
|
||||
}
|
||||
|
||||
public function testRemoveConfigSettingCanRemoveSubKeyInHash()
|
||||
{
|
||||
$manipulator = new JsonManipulator('{
|
||||
|
|
Loading…
Reference in New Issue