File tree Expand file tree Collapse file tree 1 file changed +48
-0
lines changed
tests/Integration/Schema/Directives Expand file tree Collapse file tree 1 file changed +48
-0
lines changed Original file line number Diff line number Diff line change @@ -140,6 +140,54 @@ public function testCreateFromInputObjectWithWildcardInjection(): void
140
140
]);
141
141
}
142
142
143
+ public function testCanSendEmptyArray (): void
144
+ {
145
+ $ user = factory (User::class)->create ();
146
+ $ this ->be ($ user );
147
+
148
+ $ this ->schema .= /* @lang GraphQL */ '
149
+ type Task {
150
+ id: ID!
151
+ name: String!
152
+ user: User @belongsTo
153
+ }
154
+
155
+ type User {
156
+ id: ID
157
+ }
158
+
159
+ type Mutation {
160
+ createTask(input: CreateTaskInput! @spread): Task @create
161
+ }
162
+
163
+ input CreateTaskInput {
164
+ name: String
165
+ empty_array: [String]!
166
+ user_id: ID!
167
+ }
168
+ ' ;
169
+
170
+ $ this ->graphQL ('
171
+ mutation ($id: ID!, $emptyArray: [String]!) {
172
+ createTask(input: {
173
+ name: "foo"
174
+ user_id: $id
175
+ empty_array: $emptyArray
176
+ }) {
177
+ id
178
+ }
179
+ }
180
+ ' , [
181
+ 'id ' => $ user ->getKey (),
182
+ 'emptyArray ' => [],
183
+ ])->assertJson ([
184
+ 'data ' => [
185
+ 'createTask ' => [
186
+ 'id ' => '1 ' ,
187
+ ],
188
+ ],
189
+ ]);
190
+ }
143
191
144
192
public function testWillRejectValuesNotPlacedAtArrayWithWildcardInjection (): void
145
193
{
You can’t perform that action at this time.
0 commit comments