File tree Expand file tree Collapse file tree 1 file changed +17
-2
lines changed Expand file tree Collapse file tree 1 file changed +17
-2
lines changed Original file line number Diff line number Diff line change @@ -17,6 +17,9 @@ class JsonValueMatchesMany extends Constraint
17
17
/** @var JsonValueMatches[] */
18
18
private $ constraints = array ();
19
19
20
+ /** @var string[] */
21
+ private $ failedConstraints = array ();
22
+
20
23
/**
21
24
* JsonValueMatchesMany constructor.
22
25
*
@@ -59,11 +62,23 @@ function (Constraint $constraint) {
59
62
*/
60
63
protected function matches ($ other ): bool
61
64
{
65
+ $ result = true ;
62
66
foreach ($ this ->constraints as $ constraint ) {
63
67
if (!$ constraint ->evaluate ($ other , '' , true )) {
64
- return false ;
68
+ $ result = false ;
69
+ $ this ->failedConstraints [] = $ constraint ->toString ();
65
70
}
66
71
}
67
- return true ;
72
+ return $ result ;
73
+ }
74
+
75
+ /**
76
+ * Returns a string representation of matches that evaluate to false.
77
+ *
78
+ * @return string
79
+ */
80
+ protected function additionalFailureDescription ($ other ): string
81
+ {
82
+ return "\n" . implode ("\n" , $ this ->failedConstraints );
68
83
}
69
84
}
You can’t perform that action at this time.
0 commit comments