@@ -116,23 +116,25 @@ public function testExecutesArbitraryCode()
116
116
$ deepDataType = null ;
117
117
$ dataType = new ObjectType ([
118
118
'name ' => 'DataType ' ,
119
- 'fields ' => [
120
- 'a ' => [ 'type ' => Type::string () ],
121
- 'b ' => [ 'type ' => Type::string () ],
122
- 'c ' => [ 'type ' => Type::string () ],
123
- 'd ' => [ 'type ' => Type::string () ],
124
- 'e ' => [ 'type ' => Type::string () ],
125
- 'f ' => [ 'type ' => Type::string () ],
126
- 'pic ' => [
127
- 'args ' => [ 'size ' => ['type ' => Type::int () ] ],
128
- 'type ' => Type::string (),
129
- 'resolve ' => function ($ obj , $ args ) {
130
- return $ obj ['pic ' ]($ args ['size ' ]);
131
- }
132
- ],
133
- 'promise ' => ['type ' => function () use (&$ dataType ) {return $ dataType ;}],
134
- 'deep ' => [ 'type ' => function () use (&$ deepDataType ) {return $ deepDataType ; }],
135
- ]
119
+ 'fields ' => function () use (&$ dataType , &$ deepDataType ) {
120
+ return [
121
+ 'a ' => [ 'type ' => Type::string () ],
122
+ 'b ' => [ 'type ' => Type::string () ],
123
+ 'c ' => [ 'type ' => Type::string () ],
124
+ 'd ' => [ 'type ' => Type::string () ],
125
+ 'e ' => [ 'type ' => Type::string () ],
126
+ 'f ' => [ 'type ' => Type::string () ],
127
+ 'pic ' => [
128
+ 'args ' => [ 'size ' => ['type ' => Type::int () ] ],
129
+ 'type ' => Type::string (),
130
+ 'resolve ' => function ($ obj , $ args ) {
131
+ return $ obj ['pic ' ]($ args ['size ' ]);
132
+ }
133
+ ],
134
+ 'promise ' => ['type ' => $ dataType ],
135
+ 'deep ' => ['type ' => $ deepDataType ],
136
+ ];
137
+ }
136
138
]);
137
139
138
140
$ deepDataType = new ObjectType ([
@@ -170,25 +172,25 @@ public function testMergesParallelFragments()
170
172
171
173
$ Type = new ObjectType ([
172
174
'name ' => 'Type ' ,
173
- 'fields ' => [
174
- ' a ' => [ ' type ' => Type:: string (), ' resolve ' => function () {
175
- return ' Apple ' ;
176
- }],
177
- ' b ' => [ ' type ' => Type:: string (), ' resolve ' => function () {
178
- return ' Banana ' ;
179
- }],
180
- ' c ' => [ ' type ' => Type:: string (), ' resolve ' => function () {
181
- return ' Cherry ' ;
182
- }],
183
- ' deep ' => [
184
- 'type ' => function () use (& $ Type ) {
185
- return $ Type;
186
- },
187
- ' resolve ' => function () {
188
- return [];
189
- }
190
- ]
191
- ]
175
+ 'fields ' => function () use (& $ Type ) {
176
+ return [
177
+ ' a ' => [ ' type ' => Type:: string (), ' resolve ' => function () {
178
+ return ' Apple ' ;
179
+ }],
180
+ ' b ' => [ ' type ' => Type:: string (), ' resolve ' => function () {
181
+ return ' Banana ' ;
182
+ }],
183
+ ' c ' => [ ' type ' => Type:: string (), ' resolve ' => function () {
184
+ return ' Cherry ' ;
185
+ }],
186
+ 'deep ' => [
187
+ ' type ' => $ Type,
188
+ ' resolve ' => function () {
189
+ return [];
190
+ }
191
+ ]
192
+ ];
193
+ }
192
194
]);
193
195
$ schema = new Schema (['query ' => $ Type ]);
194
196
$ expected = [
0 commit comments