@@ -103,4 +103,62 @@ public function testValidator()
103
103
104
104
$ this ->assertSame (400 , $ response ->getStatusCode (), $ response ->getContent ());
105
105
}
106
+
107
+ public function testValidatorMultiple ()
108
+ {
109
+ $ response = $ this ->json ('POST ' , '/graphql ' , ['query ' => '{ testValidatorMultiple(foo:"xyzabc") } ' ]);
110
+ $ response ->assertJson ([
111
+ 'errors ' => [
112
+ [
113
+ 'message ' => 'The foo must start with one of the following: abc ' ,
114
+ 'extensions ' => [
115
+ 'argument ' => 'foo ' ,
116
+ 'category ' => 'Validate '
117
+ ],
118
+ ],
119
+ [
120
+ 'message ' => 'The foo must end with one of the following: xyz ' ,
121
+ 'extensions ' => [
122
+ 'argument ' => 'foo ' ,
123
+ 'category ' => 'Validate '
124
+ ],
125
+ ]
126
+ ]
127
+ ]);
128
+
129
+ $ this ->assertSame (400 , $ response ->getStatusCode (), $ response ->getContent ());
130
+ $ response = $ this ->json ('POST ' , '/graphql ' , ['query ' => '{ testValidatorMultiple(foo:"abcdef") } ' ]);
131
+ $ response ->assertJson ([
132
+ 'errors ' => [
133
+ [
134
+ 'message ' => 'The foo must end with one of the following: xyz ' ,
135
+ 'extensions ' => [
136
+ 'argument ' => 'foo ' ,
137
+ 'category ' => 'Validate '
138
+ ],
139
+ ]
140
+ ]
141
+ ]);
142
+
143
+ $ this ->assertSame (400 , $ response ->getStatusCode (), $ response ->getContent ());
144
+
145
+ $ this ->assertSame (400 , $ response ->getStatusCode (), $ response ->getContent ());
146
+ $ response = $ this ->json ('POST ' , '/graphql ' , ['query ' => '{ testValidatorMultiple(foo:"uvwxyz") } ' ]);
147
+ $ response ->assertJson ([
148
+ 'errors ' => [
149
+ [
150
+ 'message ' => 'The foo must start with one of the following: abc ' ,
151
+ 'extensions ' => [
152
+ 'argument ' => 'foo ' ,
153
+ 'category ' => 'Validate '
154
+ ],
155
+ ]
156
+ ]
157
+ ]);
158
+
159
+ $ this ->assertSame (400 , $ response ->getStatusCode (), $ response ->getContent ());
160
+
161
+ $ response = $ this ->json ('POST ' , '/graphql ' , ['query ' => '{ testValidatorMultiple(foo:"abcxyz") } ' ]);
162
+ $ this ->assertSame (200 , $ response ->getStatusCode (), $ response ->getContent ());
163
+ }
106
164
}
0 commit comments