File tree Expand file tree Collapse file tree 2 files changed +29
-0
lines changed Expand file tree Collapse file tree 2 files changed +29
-0
lines changed Original file line number Diff line number Diff line change @@ -815,6 +815,21 @@ public function assertSimilarJson(array $data)
815
815
return $ this ;
816
816
}
817
817
818
+ /**
819
+ * Assert that the response contains the given JSON fragments.
820
+ *
821
+ * @param array $data
822
+ * @return $this
823
+ */
824
+ public function assertJsonFragments (array $ data )
825
+ {
826
+ foreach ($ data as $ fragment ) {
827
+ $ this ->assertJsonFragment ($ fragment );
828
+ }
829
+
830
+ return $ this ;
831
+ }
832
+
818
833
/**
819
834
* Assert that the response contains the given JSON fragment.
820
835
*
Original file line number Diff line number Diff line change @@ -1483,6 +1483,20 @@ public function testAssertJsonFragment()
1483
1483
$ response ->assertJsonFragment (['id ' => 10 ]);
1484
1484
}
1485
1485
1486
+ public function testAssertJsonFragments ()
1487
+ {
1488
+ $ response = TestResponse::fromBaseResponse (new Response (new JsonSerializableSingleResourceStub ));
1489
+
1490
+ $ response ->assertJsonFragments ([
1491
+ ['foo ' => 'foo 0 ' ],
1492
+ ]);
1493
+
1494
+ $ response ->assertJsonFragments ([
1495
+ ['foo ' => 'foo 0 ' ],
1496
+ ['foo ' => 'foo 1 ' ],
1497
+ ]);
1498
+ }
1499
+
1486
1500
public function testAssertJsonFragmentCanFail ()
1487
1501
{
1488
1502
$ this ->expectException (AssertionFailedError::class);
You can’t perform that action at this time.
0 commit comments