@@ -79,7 +79,6 @@ public function testAddKeyValuePair()
79
79
$ dot ->add ('foo.bar ' , 'baz ' );
80
80
81
81
$ this ->assertEquals ('baz ' , $ dot ->get ('foo.bar ' ));
82
- $ this ->assertInstanceOf (Dot::class, $ dot );
83
82
}
84
83
85
84
public function testAddValueToExistingKey ()
@@ -101,6 +100,13 @@ public function testAddArrayOfKeyValuePairs()
101
100
$ this ->assertSame (['foobar ' => 'baz ' , 'corge ' => 'grault ' ], $ dot ->all ());
102
101
}
103
102
103
+ public function testAddReturnsDot ()
104
+ {
105
+ $ dot = new Dot ;
106
+
107
+ $ this ->assertInstanceOf (Dot::class, $ dot ->add ('foo ' , 'bar ' ));
108
+ }
109
+
104
110
/*
105
111
* --------------------------------------------------------------
106
112
* All
@@ -126,7 +132,6 @@ public function testClearKey()
126
132
$ dot ->clear ('foo.bar ' );
127
133
128
134
$ this ->assertSame ([], $ dot ->get ('foo.bar ' ));
129
- $ this ->assertInstanceOf (Dot::class, $ dot );
130
135
}
131
136
132
137
public function testClearNonExistingKey ()
@@ -153,6 +158,13 @@ public function testClearAll()
153
158
$ this ->assertSame ([], $ dot ->all ());
154
159
}
155
160
161
+ public function testClearReturnsDot ()
162
+ {
163
+ $ dot = new Dot ();
164
+
165
+ $ this ->assertInstanceOf (Dot::class, $ dot ->clear ());
166
+ }
167
+
156
168
/*
157
169
* --------------------------------------------------------------
158
170
* Delete
@@ -165,7 +177,6 @@ public function testDeleteKey()
165
177
$ dot ->delete ('foo.bar ' );
166
178
167
179
$ this ->assertFalse ($ dot ->has ('foo.bar ' ));
168
- $ this ->assertInstanceOf (Dot::class, $ dot );
169
180
}
170
181
171
182
public function testDeleteNonExistingKey ()
@@ -184,6 +195,13 @@ public function testDeleteArrayOfKeys()
184
195
$ this ->assertSame ([], $ dot ->all ());
185
196
}
186
197
198
+ public function testDeleteReturnsDot ()
199
+ {
200
+ $ dot = new Dot (['foo ' => 'bar ' ]);
201
+
202
+ $ this ->assertInstanceOf (Dot::class, $ dot ->clear ('foo ' ));
203
+ }
204
+
187
205
/*
188
206
* --------------------------------------------------------------
189
207
* Flatten
@@ -318,7 +336,6 @@ public function testMergeArrayWithDot()
318
336
$ dot ->merge (['foo ' => ['bar ' => 'qux ' ]]);
319
337
320
338
$ this ->assertEquals ('qux ' , $ dot ->get ('foo.bar ' ));
321
- $ this ->assertInstanceOf (Dot::class, $ dot );
322
339
}
323
340
324
341
public function testMergeArrayWithKey ()
@@ -347,6 +364,13 @@ public function testMergeDotObjectWithKey()
347
364
$ this ->assertEquals ('qux ' , $ dot1 ->get ('foo.bar ' ));
348
365
}
349
366
367
+ public function testMergeReturnsDot ()
368
+ {
369
+ $ dot = new Dot (['foo ' => ['bar ' => 'baz ' ]]);
370
+
371
+ $ this ->assertInstanceOf (Dot::class, $ dot ->merge (['foo ' => ['bar ' => 'qux ' ]]));
372
+ }
373
+
350
374
/*
351
375
* --------------------------------------------------------------
352
376
* Recursive merge
@@ -360,7 +384,6 @@ public function testRecursiveMergeArrayWithDot()
360
384
361
385
$ this ->assertEquals (['baz ' , 'qux ' ], $ dot ->get ('foo.bar ' ));
362
386
$ this ->assertEquals ('quuz ' , $ dot ->get ('foo.quux ' ));
363
- $ this ->assertInstanceOf (Dot::class, $ dot );
364
387
}
365
388
366
389
public function testRecursiveMergeArrayWithKey ()
@@ -392,6 +415,16 @@ public function testRecursiveMergeDotObjectWithKey()
392
415
$ this ->assertEquals ('quuz ' , $ dot1 ->get ('foo.quux ' ));
393
416
}
394
417
418
+ public function testRecursiveMergeReturnsDot ()
419
+ {
420
+ $ dot = new Dot (['foo ' => ['bar ' => 'baz ' ]]);
421
+
422
+ $ this ->assertInstanceOf (
423
+ Dot::class,
424
+ $ dot ->mergeRecursive (['foo ' => ['bar ' => 'qux ' , 'quux ' => 'quuz ' ]])
425
+ );
426
+ }
427
+
395
428
/*
396
429
* --------------------------------------------------------------
397
430
* Recursive distinct merge
@@ -405,7 +438,6 @@ public function testRecursiveDistinctMergeArrayWithDot()
405
438
406
439
$ this ->assertEquals ('qux ' , $ dot ->get ('foo.bar ' ));
407
440
$ this ->assertEquals ('quuz ' , $ dot ->get ('foo.quux ' ));
408
- $ this ->assertInstanceOf (Dot::class, $ dot );
409
441
}
410
442
411
443
public function testRecursiveDistinctMergeArrayWithKey ()
@@ -437,6 +469,16 @@ public function testRecursiveDistinctMergeDotObjectWithKey()
437
469
$ this ->assertEquals ('quuz ' , $ dot1 ->get ('foo.quux ' ));
438
470
}
439
471
472
+ public function testRecursivDistincteMergeReturnsDot ()
473
+ {
474
+ $ dot = new Dot (['foo ' => ['bar ' => 'baz ' ]]);
475
+
476
+ $ this ->assertInstanceOf (
477
+ Dot::class,
478
+ $ dot ->mergeRecursiveDistinct (['foo ' => ['bar ' => 'qux ' , 'quux ' => 'quuz ' ]])
479
+ );
480
+ }
481
+
440
482
/*
441
483
* --------------------------------------------------------------
442
484
* Pull
@@ -485,7 +527,6 @@ public function testPushValue()
485
527
$ dot ->push ('foo ' );
486
528
487
529
$ this ->assertEquals ('foo ' , $ dot ->get (0 ));
488
- $ this ->assertInstanceOf (Dot::class, $ dot );
489
530
}
490
531
491
532
public function testPushValueToKey ()
@@ -496,6 +537,13 @@ public function testPushValueToKey()
496
537
$ this ->assertSame (['bar ' , 'baz ' ], $ dot ->get ('foo ' ));
497
538
}
498
539
540
+ public function testPushReturnsDot ()
541
+ {
542
+ $ dot = $ dot = new Dot ();
543
+
544
+ $ this ->assertInstanceOf (Dot::class, $ dot ->push ('foo ' ));
545
+ }
546
+
499
547
/*
500
548
* --------------------------------------------------------------
501
549
* Replace
@@ -508,7 +556,6 @@ public function testReplaceWithArray()
508
556
$ dot ->replace (['foo ' => ['qux ' => 'quux ' ]]);
509
557
510
558
$ this ->assertEquals (['qux ' => 'quux ' ], $ dot ->get ('foo ' ));
511
- $ this ->assertInstanceOf (Dot::class, $ dot );
512
559
}
513
560
514
561
public function testReplaceKeyWithArray ()
@@ -537,6 +584,13 @@ public function testReplaceKeyWithDot()
537
584
$ this ->assertEquals (['bar ' => 'baz ' , 'qux ' => 'corge ' ], $ dot1 ->get ('foo ' ));
538
585
}
539
586
587
+ public function testReplaceReturnsDot ()
588
+ {
589
+ $ dot = new Dot (['foo ' => ['bar ' => 'baz ' ]]);
590
+
591
+ $ this ->assertInstanceOf (Dot::class, $ dot ->replace (['foo ' => ['qux ' => 'quux ' ]]));
592
+ }
593
+
540
594
/*
541
595
* --------------------------------------------------------------
542
596
* Set
@@ -549,7 +603,6 @@ public function testSetKeyValuePair()
549
603
$ dot ->set ('foo.bar ' , 'baz ' );
550
604
551
605
$ this ->assertEquals ('baz ' , $ dot ->get ('foo.bar ' ));
552
- $ this ->assertInstanceOf (Dot::class, $ dot );
553
606
}
554
607
555
608
public function testSetArrayOfKeyValuePairs ()
@@ -560,6 +613,13 @@ public function testSetArrayOfKeyValuePairs()
560
613
$ this ->assertSame (['foo ' => 'bar ' , 'baz ' => 'qux ' ], $ dot ->all ());
561
614
}
562
615
616
+ public function testSetReturnsDot ()
617
+ {
618
+ $ dot = new Dot ();
619
+
620
+ $ this ->assertInstanceOf (Dot::class, $ dot ->set ('foo.bar ' , 'baz ' ));
621
+ }
622
+
563
623
/*
564
624
* --------------------------------------------------------------
565
625
* Set array
@@ -572,7 +632,13 @@ public function testSetArray()
572
632
$ dot ->setArray (['foo ' => 'bar ' ]);
573
633
574
634
$ this ->assertSame (['foo ' => 'bar ' ], $ dot ->all ());
575
- $ this ->assertInstanceOf (Dot::class, $ dot );
635
+ }
636
+
637
+ public function testSetArrayReturnsDot ()
638
+ {
639
+ $ dot = new Dot ();
640
+
641
+ $ this ->assertInstanceOf (Dot::class, $ dot ->setArray (['foo ' => 'bar ' ]));
576
642
}
577
643
578
644
/*
@@ -589,7 +655,14 @@ public function testSetReference()
589
655
$ dot ->set ('foo ' , 'baz ' );
590
656
591
657
$ this ->assertEquals ('baz ' , $ items ['foo ' ]);
592
- $ this ->assertInstanceOf (Dot::class, $ dot );
658
+ }
659
+
660
+ public function testSetReferenceReturnsDot ()
661
+ {
662
+ $ dot = new Dot ();
663
+ $ items = ['foo ' => 'bar ' ];
664
+
665
+ $ this ->assertInstanceOf (Dot::class, $ dot ->setReference ($ items ));
593
666
}
594
667
595
668
/*
0 commit comments