1
0
Fork 0

add test on remove mainkey at end of file

pull/6675/merge
Deamon 2017-09-11 15:58:03 +02:00 committed by Jordi Boggiano
parent 5b29b7c8e3
commit 3d753b117b
1 changed files with 30 additions and 0 deletions

View File

@ -2331,4 +2331,34 @@ class JsonManipulatorTest extends \PHPUnit_Framework_TestCase
}
', $manipulator->getContents());
}
public function testRemoveMainKeyAtEndOfFile()
{
$manipulator = new JsonManipulator('{
"require": {
"package/a": "*"
}
}
');
$this->assertTrue($manipulator->addMainKey('homepage', 'http...'));
$this->assertTrue($manipulator->addMainKey('license', 'mit'));
$this->assertEquals('{
"require": {
"package/a": "*"
},
"homepage": "http...",
"license": "mit"
}
', $manipulator->getContents());
$this->assertTrue($manipulator->removeMainKey('homepage'));
$this->assertTrue($manipulator->removeMainKey('license'));
$this->assertEquals('{
"require": {
"package/a": "*"
}
}
', $manipulator->getContents());
}
}