Skip to content

Commit

Permalink
Merge remote-tracking branch 'joomla/pr/38'
Browse files Browse the repository at this point in the history
  • Loading branch information
mbabker committed Apr 18, 2016
2 parents 0ea3048 + fc17096 commit 4bd09f1
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions Tests/format/JsonTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ public function testADataObjectIsConvertedToAString()
$object->booleanfalse = false;
$object->numericint = 42;
$object->numericfloat = 3.1415;
// A string that looks like an unicode sequence, should remain what it is: a string
$object->unicodesequence = '\u0000';

// The PHP registry format does not support nested objects
$object->section = new \stdClass;
Expand All @@ -38,10 +40,15 @@ public function testADataObjectIsConvertedToAString()
$string = '{"foo":"bar","quoted":"\"stringwithquotes\"",' .
'"booleantrue":true,"booleanfalse":false,' .
'"numericint":42,"numericfloat":3.1415,' .
'"unicodesequence":"\\\\u0000",' .
'"section":{"key":"value"},' .
'"array":{"nestedarray":{"test1":"value1"}}' .
'}';

$decoded = json_decode($class->objectToString($object));
// Ensures that the generated string respects the json syntax
$this->assertNotEquals($decoded, null);

// Test basic object to string.
$this->assertSame($string, $class->objectToString($object));
}
Expand Down

0 comments on commit 4bd09f1

Please sign in to comment.