File tree Expand file tree Collapse file tree 1 file changed +14
-2
lines changed
Expand file tree Collapse file tree 1 file changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -226,7 +226,13 @@ public function theJsonNodeShouldContain($node, $text): void
226226
227227 $ actual = $ this ->inspector ->evaluate ($ json , $ node );
228228
229- $ this ->assertContains ($ text , (string ) $ actual );
229+ $ printedActual = strlen ($ actual ) > 50 ? substr ($ actual , 0 , 50 ) . '[…] ' : $ actual ;
230+
231+ $ this ->assertContains (
232+ $ text ,
233+ (string ) $ actual ,
234+ 'The node " ' .$ node .'" does not contain the expected text " ' .$ text .'" (found " ' .$ printedActual .'") '
235+ );
230236 }
231237
232238 /**
@@ -252,7 +258,13 @@ public function theJsonNodeShouldNotContain($node, $text): void
252258
253259 $ actual = $ this ->inspector ->evaluate ($ json , $ node );
254260
255- $ this ->assertNotContains ($ text , (string ) $ actual );
261+ $ printedActual = strlen ($ actual ) > 50 ? substr ($ actual , 0 , 50 ) . '[…] ' : $ actual ;
262+
263+ $ this ->assertNotContains (
264+ $ text ,
265+ (string ) $ actual ,
266+ 'The node " ' .$ node .'" does contain " ' .$ text .'" while it should not (found " ' .$ printedActual .'") '
267+ );
256268 }
257269
258270 /**
You can’t perform that action at this time.
0 commit comments