@@ -1016,7 +1016,18 @@ public function testAddObj02() {
10161016 /**
10171017 * @test
10181018 */
1019- public function testAddStringTest00 () {
1019+ public function testAddObj03 () {
1020+ $ j = new Json ();
1021+ $ obj = new Obj1 ('Hello ' ,0 ,true ,null ,'he ' );
1022+ $ j ->addString ('object ' ,'An Obj ' );
1023+ $ this ->assertEquals ('An Obj ' , $ j ->get ('object ' ));
1024+ $ j ->addObject ('object ' , $ obj );
1025+ $ this ->assertEquals ('{"object":{"property-00":"Hello","property-01":0,"property-02":true}} ' ,$ j .'' );
1026+ }
1027+ /**
1028+ * @test
1029+ */
1030+ public function testAddString00 () {
10201031 $ this ->expectException (\InvalidArgumentException::class);
10211032 $ j = new Json ();
10221033 $ this ->assertFalse ($ j ->addString ('' ,'Hello World! ' ));
@@ -1027,7 +1038,7 @@ public function testAddStringTest00() {
10271038 /**
10281039 * @test
10291040 */
1030- public function testAddStringTest01 () {
1041+ public function testAddString01 () {
10311042 $ j = new Json ();
10321043 $ this ->assertTrue ($ j ->addString ('hello ' ,'Hello World! ' ));
10331044 $ this ->assertEquals ('{"hello":"Hello World!"} ' ,$ j .'' );
@@ -1036,10 +1047,21 @@ public function testAddStringTest01() {
10361047 /**
10371048 * @test
10381049 */
1039- public function testAddStringTest02 () {
1050+ public function testAddString02 () {
10401051 $ j = new Json ();
10411052 $ this ->assertFalse ($ j ->addBoolean ('invalid-boolean ' ,'falseX ' ));
10421053 }
1054+ /**
1055+ * @test
1056+ */
1057+ public function testAddString03 () {
1058+ $ j = new Json ();
1059+ $ j ->addNumber ('a-number ' , 33 );
1060+ $ this ->assertSame (33 , $ j ->get ('a-number ' ));
1061+ $ j ->addString ('a-number ' , '33 ' );
1062+ $ this ->assertNotSame (33 , $ j ->get ('a-number ' ));
1063+ $ this ->assertEquals ('33 ' , $ j ->get ('a-number ' ));
1064+ }
10431065 /**
10441066 * @test
10451067 */
0 commit comments