1
0
Fork 0

Enhancement: Assert that key is removed when value is null

pull/6945/head
Andreas Möller 2017-12-27 19:43:31 +01:00
parent 57b3e24514
commit 79828f7543
No known key found for this signature in database
GPG Key ID: 9FB20A0BAF60E11F
1 changed files with 16 additions and 0 deletions

View File

@ -2310,6 +2310,22 @@ class JsonManipulatorTest extends TestCase
', $manipulator->getContents());
}
public function testRemoveMainKeyRemovesKeyWhereValueIsNull()
{
$manipulator = new JsonManipulator(json_encode(array(
'foo' => 9000,
'bar' => null,
)));
$manipulator->removeMainKey('bar');
$expected = json_encode(array(
'foo' => 9000,
));
$this->assertJsonStringEqualsJsonString($expected, $manipulator->getContents());
}
public function testIndentDetection()
{
$manipulator = new JsonManipulator('{