mirror of
https://github.com/composer/composer
synced 2025-05-09 00:22:53 +00:00
Fix indent detection in json files when an empty line starts the object
This commit is contained in:
parent
32a479a1e7
commit
fa398e14c7
2 changed files with 23 additions and 1 deletions
|
@ -1112,6 +1112,28 @@ class JsonManipulatorTest extends \PHPUnit_Framework_TestCase
|
|||
"foo": "qux"
|
||||
}
|
||||
}
|
||||
', $manipulator->getContents());
|
||||
}
|
||||
|
||||
public function testIndentDetection()
|
||||
{
|
||||
$manipulator = new JsonManipulator('{
|
||||
|
||||
"require": {
|
||||
"php": "5.*"
|
||||
}
|
||||
}');
|
||||
|
||||
$this->assertTrue($manipulator->addMainKey('require-dev', array('foo' => 'qux')));
|
||||
$this->assertEquals('{
|
||||
|
||||
"require": {
|
||||
"php": "5.*"
|
||||
},
|
||||
"require-dev": {
|
||||
"foo": "qux"
|
||||
}
|
||||
}
|
||||
', $manipulator->getContents());
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue