Conditions | 1 |
Paths | 1 |
Total Lines | 13 |
Code Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Changes | 2 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
14 | public function testPatchApply() |
||
15 | { |
||
16 | $old = json_decode(json_encode(["emptyObject" => []])); |
||
17 | $new = json_decode(json_encode(["emptyObject" => ["notEmpty"=>"value"]])); |
||
18 | $diff = new JsonDiff($old, $new); |
||
19 | $patch = $diff->getPatch(); |
||
20 | $this->assertNotEquals($new, $old); |
||
21 | $patch->apply($old); |
||
22 | $this->assertEquals($new, $old); |
||
23 | |||
24 | $old = json_decode(json_encode(["emptyObject" => []])); |
||
25 | $this->setExpectedException(get_class(new Exception()), 'Invalid key for array operation'); |
||
26 | $patch->setFlags(JsonPatch::STRICT_MODE)->apply($old); |
||
27 | } |
||
29 |