Completed
Push — master ( e891dc...f1a729 )
by Alexandr
03:27
created

ProcessorTest::testComplexityReducer()   B

Complexity

Conditions 4
Paths 2

Size

Total Lines 84
Code Lines 45

Duplication

Lines 0
Ratio 0 %

Importance

Changes 3
Bugs 0 Features 1
Metric Value
c 3
b 0
f 1
dl 0
loc 84
rs 8.4704
cc 4
eloc 45
nc 2
nop 0

How to fix   Long Method   

Long Method

Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.

For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.

Commonly applied refactorings include:

1
<?php
2
/*
3
 * This file is a part of GraphQL project.
4
 *
5
 * @author Alexandr Viniychuk <[email protected]>
6
 * created: 11:02 PM 5/13/16
7
 */
8
9
namespace Youshido\Tests\Schema;
10
11
12
use Youshido\GraphQL\Execution\Processor;
13
use Youshido\GraphQL\Execution\ResolveInfo;
14
use Youshido\GraphQL\Field\Field;
15
use Youshido\GraphQL\Schema\Schema;
16
use Youshido\GraphQL\Type\ListType\ListType;
17
use Youshido\GraphQL\Type\NonNullType;
18
use Youshido\GraphQL\Type\Object\ObjectType;
19
use Youshido\GraphQL\Type\Scalar\BooleanType;
20
use Youshido\GraphQL\Type\Scalar\IdType;
21
use Youshido\GraphQL\Type\Scalar\IntType;
22
use Youshido\GraphQL\Type\Scalar\StringType;
23
use Youshido\GraphQL\Type\Union\UnionType;
24
use Youshido\Tests\DataProvider\TestEmptySchema;
25
use Youshido\Tests\DataProvider\TestEnumType;
26
use Youshido\Tests\DataProvider\TestInterfaceType;
27
use Youshido\Tests\DataProvider\TestObjectType;
28
use Youshido\Tests\DataProvider\TestSchema;
29
30
class ProcessorTest extends \PHPUnit_Framework_TestCase
31
{
32
33
    private $_counter = 0;
34
35
    /**
36
     * @expectedException \Youshido\GraphQL\Validator\Exception\ConfigurationException
37
     * @expectedExceptionMessage Schema has to have fields
38
     */
39
    public function testInit()
40
    {
41
        new Processor(new TestEmptySchema());
42
    }
43
44
    public function testEmptyQueries()
45
    {
46
        $processor = new Processor(new TestSchema());
47
        $processor->processPayload('');
48
        $this->assertEquals(['errors' => [
49
            ['message' => 'Must provide an operation.']
50
        ]], $processor->getResponseData());
51
52
        $processor->processPayload('{ me { name } }');
53
        $this->assertEquals(['data' => [
54
            'me' => ['name' => 'John']
55
        ]], $processor->getResponseData());
56
57
    }
58
59
    public function testNestedVariables()
60
    {
61
        $processor    = new Processor(new TestSchema());
62
        $noArgsQuery  = '{ me { echo(value:"foo") } }';
63
        $expectedData = ['data' => ['me' => ['echo' => 'foo']]];
64
        $processor->processPayload($noArgsQuery, ['value' => 'foo']);
65
        $this->assertEquals($expectedData, $processor->getResponseData());
66
67
        $parameterizedFieldQuery =
68
            'query nestedFieldQuery($value:String!){
69
          me {
70
            echo(value:$value)
71
          }
72
        }';
73
        $processor->processPayload($parameterizedFieldQuery, ['value' => 'foo']);
74
        $this->assertEquals($expectedData, $processor->getResponseData());
75
76
        $parameterizedQueryQuery =
77
            'query nestedQueryQuery($value:Int){
78
          me {
79
            location(noop:$value) {
80
              address
81
            }
82
          }
83
        }';
84
        $processor->processPayload($parameterizedQueryQuery, ['value' => 1]);
85
        $this->assertArrayNotHasKey('errors', $processor->getResponseData());
86
    }
87
88 View Code Duplication
    public function testListNullResponse()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
89
    {
90
        $processor = new Processor(new Schema([
91
            'query' => new ObjectType([
92
                'name'   => 'RootQuery',
93
                'fields' => [
94
                    'list' => [
95
                        'type'    => new ListType(new StringType()),
96
                        'resolve' => function () {
97
                            return null;
98
                        }
99
                    ]
100
                ]
101
            ])
102
        ]));
103
        $data      = $processor->processPayload(' { list }')->getResponseData();
104
        $this->assertEquals(['data' => ['list' => null]], $data);
105
    }
106
107
108 View Code Duplication
    public function testSubscriptionNullResponse()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
109
    {
110
        $processor = new Processor(new Schema([
111
            'query' => new ObjectType([
112
                'name'   => 'RootQuery',
113
                'fields' => [
114
                    'list' => [
115
                        'type'    => new ListType(new StringType()),
116
                        'resolve' => function () {
117
                            return null;
118
                        }
119
                    ]
120
                ]
121
            ])
122
        ]));
123
        $data      = $processor->processPayload(' { __schema { subscriptionType { name } } }')->getResponseData();
124
        $this->assertEquals(['data' => ['__schema' => ['subscriptionType' => null]]], $data);
125
    }
126
127
    public function testSchemaOperations()
128
    {
129
        $schema    = new Schema([
130
            'query' => new ObjectType([
131
                'name'   => 'RootQuery',
132
                'fields' => [
133
                    'me'                => [
134
                        'type'    => new ObjectType([
135
                            'name'   => 'User',
136
                            'fields' => [
137
                                'firstName' => [
138
                                    'type'    => new StringType(),
139
                                    'args'    => [
140
                                        'shorten' => new BooleanType()
141
                                    ],
142
                                    'resolve' => function ($value, $args) {
143
                                        return empty($args['shorten']) ? $value : $value;
144
                                    }
145
                                ],
146
                                'id_alias'  => [
147
                                    'type'    => new IdType(),
148
                                    'resolve' => function ($value) {
149
                                        return $value['id'];
150
                                    }
151
                                ],
152
                                'lastName'  => new StringType(),
153
                                'code'      => new StringType(),
154
                            ]
155
                        ]),
156
                        'resolve' => function ($value, $args) {
157
                            $data = ['id' => '123', 'firstName' => 'John', 'code' => '007'];
158
                            if (!empty($args['upper'])) {
159
                                foreach ($data as $key => $value) {
160
                                    $data[$key] = strtoupper($value);
161
                                }
162
                            }
163
164
                            return $data;
165
                        },
166
                        'args'    => [
167
                            'upper' => [
168
                                'type'    => new BooleanType(),
169
                                'default' => false
170
                            ]
171
                        ]
172
                    ],
173
                    'randomUser'        => [
174
                        'type'    => new TestObjectType(),
175
                        'resolve' => function () {
176
                            return ['invalidField' => 'John'];
177
                        }
178
                    ],
179
                    'invalidValueQuery' => [
180
                        'type'    => new TestObjectType(),
181
                        'resolve' => function () {
182
                            return 'stringValue';
183
                        }
184
                    ],
185
                    'labels'            => [
186
                        'type'    => new ListType(new StringType()),
187
                        'resolve' => function () {
188
                            return ['one', 'two'];
189
                        }
190
                    ]
191
                ],
192
            ])
193
        ]);
194
        $processor = new Processor($schema);
195
196
        $processor->processPayload('{ me { firstName } }');
197
        $this->assertEquals(['data' => ['me' => ['firstName' => 'John']]], $processor->getResponseData());
198
199
        $processor->processPayload('{ me { id_alias } }');
200
        $this->assertEquals(['data' => ['me' => ['id_alias' => '123']]], $processor->getResponseData());
201
202
        $processor->processPayload('{ me { firstName, lastName } }');
203
        $this->assertEquals(['data' => ['me' => ['firstName' => 'John', 'lastName' => null]]], $processor->getResponseData());
204
205
        $processor->processPayload('{ me { code } }');
206
        $this->assertEquals(['data' => ['me' => ['code' => 7]]], $processor->getResponseData());
207
208
        $processor->processPayload('{ me(upper:true) { firstName } }');
209
        $this->assertEquals(['data' => ['me' => ['firstName' => 'JOHN']]], $processor->getResponseData());
210
211
        $processor->processPayload('{ labels }');
212
        $this->assertEquals(['data' => ['labels' => ['one', 'two']]], $processor->getResponseData());
213
214
        $schema->getMutationType()
215
               ->addField(new Field([
216
                   'name'    => 'increaseCounter',
217
                   'type'    => new IntType(),
218
                   'resolve' => function ($value, $args, ResolveInfo $info) {
0 ignored issues
show
Unused Code introduced by
The parameter $info is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
219
                       return $this->_counter += $args['amount'];
220
                   },
221
                   'args'    => [
222
                       'amount' => [
223
                           'type'    => new IntType(),
224
                           'default' => 1
225
                       ]
226
                   ]
227
               ]))->addField(new Field([
228
                'name'    => 'invalidResolveTypeMutation',
229
                'type'    => new NonNullType(new IntType()),
230
                'resolve' => function () {
231
                    return null;
232
                }
233
            ]))->addField(new Field([
234
                'name'    => 'interfacedMutation',
235
                'type'    => new TestInterfaceType(),
236
                'resolve' => function () {
237
                    return ['name' => 'John'];
238
                }
239
            ]));
240
        $processor->processPayload('mutation { increaseCounter }');
241
        $this->assertEquals(['data' => ['increaseCounter' => 1]], $processor->getResponseData());
242
243
        $processor->processPayload('mutation { invalidMutation }');
244
        $this->assertEquals(['errors' => [['message' => 'Field "invalidMutation" not found in type "RootSchemaMutation"']]], $processor->getResponseData());
245
246
        $processor->processPayload('mutation { increaseCounter(noArg: 2) }');
247
        $this->assertEquals(['errors' => [['message' => 'Unknown argument "noArg" on field "increaseCounter"']]], $processor->getResponseData());
248
249
        $processor->processPayload('mutation { increaseCounter(amount: 2) { invalidProp } }');
250
        $this->assertEquals(['errors' => [['message' => 'Field "invalidProp" not found in type "Int"']], 'data' => ['increaseCounter' => null]], $processor->getResponseData());
251
252
        $processor->processPayload('mutation { increaseCounter(amount: 2) }');
253
        $this->assertEquals(['data' => ['increaseCounter' => 5]], $processor->getResponseData());
254
255
        $processor->processPayload('{ invalidQuery }');
256
        $this->assertEquals(['errors' => [['message' => 'Field "invalidQuery" not found in type "RootQuery"']]], $processor->getResponseData());
257
258
        $processor->processPayload('{ invalidValueQuery { id } }');
259
        $this->assertEquals(['errors' => [['message' => 'Not valid value for OBJECT field invalidValueQuery']], 'data' => ['invalidValueQuery' => null]], $processor->getResponseData());
260
261
        $processor->processPayload('{ me { firstName(shorten: true), middle }}');
262
        $this->assertEquals(['errors' => [['message' => 'Field "middle" not found in type "User"']], 'data' => ['me' => null]], $processor->getResponseData());
263
264
        $processor->processPayload('{ randomUser { region }}');
265
        $this->assertEquals(['errors' => [['message' => 'Property "region" not found in resolve result']]], $processor->getResponseData());
266
267
        $processor->processPayload('mutation { invalidResolveTypeMutation }');
268
        $this->assertEquals(['errors' => [['message' => 'Cannot return null for non-nullable field invalidResolveTypeMutation']], 'data' => ['invalidResolveTypeMutation' => null]], $processor->getResponseData());
269
270
        $processor->processPayload('mutation { user:interfacedMutation { name }  }');
271
        $this->assertEquals(['data' => ['user' => ['name' => 'John']]], $processor->getResponseData());
272
    }
273
274
    public function testListEnumsSchemaOperations()
275
    {
276
        $processor = new Processor(new Schema([
277
            'query' => new ObjectType([
278
                'name'   => 'RootQuery',
279
                'fields' => [
280
                    'listQuery'                 => [
281
                        'type'    => new ListType(new TestEnumType()),
282
                        'resolve' => function () {
283
                            return 'invalid list';
284
                        }
285
                    ],
286
                    'listEnumQuery'             => [
287
                        'type'    => new ListType(new TestEnumType()),
288
                        'resolve' => function () {
289
                            return ['invalid enum'];
290
                        }
291
                    ],
292
                    'invalidEnumQuery'          => [
293
                        'type'    => new TestEnumType(),
294
                        'resolve' => function () {
295
                            return 'invalid enum';
296
                        }
297
                    ],
298
                    'enumQuery'                 => [
299
                        'type'    => new TestEnumType(),
300
                        'resolve' => function () {
301
                            return 1;
302
                        }
303
                    ],
304
                    'invalidNonNullQuery'       => [
305
                        'type'    => new NonNullType(new IntType()),
306
                        'resolve' => function () {
307
                            return null;
308
                        }
309
                    ],
310
                    'invalidNonNullInsideQuery' => [
311
                        'type'    => new NonNullType(new IntType()),
312
                        'resolve' => function () {
313
                            return 'hello';
314
                        }
315
                    ],
316
                    'objectQuery'               => [
317
                        'type'    => new TestObjectType(),
318
                        'resolve' => function () {
319
                            return ['name' => 'John'];
320
                        }
321
                    ],
322
                    'deepObjectQuery'           => [
323
                        'type'    => new ObjectType([
324
                            'name'   => 'deepObject',
325
                            'fields' => [
326
                                'object' => new TestObjectType(),
327
                                'enum'   => new TestEnumType(),
328
                            ],
329
                        ]),
330
                        'resolve' => function () {
331
                            return [
332
                                'object' => [
333
                                    'name' => 'John'
334
                                ],
335
                                'enum'   => 1
336
                            ];
337
                        },
338
                    ],
339
                ]
340
            ])
341
        ]));
342
343
        $processor->processPayload('{ listQuery }');
344
        $this->assertEquals(['errors' => [
345
            ['message' => 'Not valid value for LIST field listQuery']
346
        ], 'data'                     => ['listQuery' => null]], $processor->getResponseData());
347
348
        $processor->processPayload('{ listEnumQuery }');
349
        $this->assertEquals(['errors' => [
350
            ['message' => 'Not valid resolve value in listEnumQuery field']
351
        ], 'data'                     => ['listEnumQuery' => [null]]], $processor->getResponseData());
352
353
        $processor->processPayload('{ invalidEnumQuery }');
354
        $this->assertEquals(['errors' => [
355
            ['message' => 'Not valid value for ENUM field invalidEnumQuery']
356
        ], 'data'                     => ['invalidEnumQuery' => null]], $processor->getResponseData());
357
358
        $processor->processPayload('{ enumQuery }');
359
        $this->assertEquals(['data' => ['enumQuery' => 'FINISHED']], $processor->getResponseData());
360
361
        $processor->processPayload('{ invalidNonNullQuery }');
362
        $this->assertEquals(['errors' => [
363
            ['message' => 'Cannot return null for non-nullable field invalidNonNullQuery']
364
        ], 'data'                     => ['invalidNonNullQuery' => null]], $processor->getResponseData());
365
366
        $processor->processPayload('{ invalidNonNullInsideQuery }');
367
        $this->assertEquals(['errors' => [
368
            ['message' => 'Not valid value for SCALAR field invalidNonNullInsideQuery']
369
        ], 'data'                     => ['invalidNonNullInsideQuery' => null]], $processor->getResponseData());
370
371
        $processor->processPayload('{ test:deepObjectQuery { object { name } } }');
372
        $this->assertEquals(['data' => ['test' => ['object' => ['name' => 'John']]]], $processor->getResponseData());
373
    }
374
375
    public function testTypedFragment()
376
    {
377
378
        $object1 = new ObjectType([
379
            'name'   => 'Object1',
380
            'fields' => [
381
                'id' => ['type' => 'int', 'cost' => 13]
382
            ]
383
        ]);
384
385
        $object2 = new ObjectType([
386
            'name'   => 'Object2',
387
            'fields' => [
388
                'name' => ['type' => 'string']
389
            ]
390
        ]);
391
392
        $object3 = new ObjectType([
393
            'name'   => 'Object3',
394
            'fields' => [
395
                'name' => ['type' => 'string']
396
            ]
397
        ]);
398
399
        $union        = new UnionType([
400
            'name'        => 'TestUnion',
401
            'types'       => [$object1, $object2],
402
            'resolveType' => function ($object) use ($object1, $object2) {
403
                if (isset($object['id'])) {
404
                    return $object1;
405
                }
406
407
                return $object2;
408
            }
409
        ]);
410
        $invalidUnion = new UnionType([
411
            'name'        => 'TestUnion',
412
            'types'       => [$object1, $object2],
413
            'resolveType' => function ($object) use ($object3) {
0 ignored issues
show
Unused Code introduced by
The parameter $object is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
414
                return $object3;
415
            }
416
        ]);
417
        $processor    = new Processor(new Schema([
418
            'query' => new ObjectType([
419
                'name'   => 'RootQuery',
420
                'fields' => [
421
                    'union'        => [
422
                        'type'    => $union,
423
                        'args'    => [
424
                            'type' => ['type' => 'string']
425
                        ],
426
                        'cost' => 10,
427
                        'resolve' => function ($value, $args) {
428
                            if ($args['type'] == 'object1') {
429
                                return [
430
                                    'id' => 43
431
                                ];
432
                            } else {
433
                                return [
434
                                    'name' => 'name resolved'
435
                                ];
436
                            }
437
                        }
438
                    ],
439
                    'invalidUnion' => [
440
                        'type'    => $invalidUnion,
441
                        'resolve' => function () {
442
                            return ['name' => 'name resolved'];
443
                        }
444
                    ],
445
                ]
446
            ])
447
        ]));
448
        $processor->processPayload('{ union(type: "object1") { ... on Object2 { id } } }');
449
        $this->assertEquals(['data' => ['union' => []]], $processor->getResponseData());
450
451
        $processor->processPayload('{ union(type: "object1") { ... on Object1 { name } } }');
452
        $this->assertEquals([
453
            'data'   => [
454
                'union' => []
455
            ],
456
            'errors' => [
457
                ['message' => 'Field "name" not found in type "Object1"']
458
            ]
459
        ], $processor->getResponseData());
460
461
        $processor->processPayload('{ union(type: "object1") { ... on Object1 { id } } }');
462
        $this->assertEquals(['data' => ['union' => ['id' => 43]]], $processor->getResponseData());
463
464
        $processor->processPayload('{ union(type: "asd") { ... on Object2 { name } } }');
465
        $this->assertEquals(['data' => ['union' => ['name' => 'name resolved']]], $processor->getResponseData());
466
467
        $processor->processPayload('{ invalidUnion { ... on Object2 { name } } }');
468
        $this->assertEquals(['errors' => [['message' => 'Type Object3 not exist in types of Object2']]], $processor->getResponseData());
469
470
        $visitor = new \Youshido\GraphQL\Execution\Visitor\MaxComplexityQueryVisitor(1000); // arbitrarily high cost
471
        $processor->processPayload('{ union(type: "object1") { ... on Object1 { id } } }', [], [$visitor]);
472
        $this->assertEquals(10 + 13, $visitor->getMemo());
473
474
        $visitor = new \Youshido\GraphQL\Execution\Visitor\MaxComplexityQueryVisitor(1000); // arbitrarily high cost
475
        $processor->processPayload('{ union(type: "object1") { ... on Object1 { id }, ... on Object2 { name } } }', [], [$visitor]);
476
        $this->assertEquals(10 + 13 + 1, $visitor->getMemo());
477
478
        // planning phase currently has no knowledge of what types the union will resolve to, this will have the same score as above
479
        $visitor = new \Youshido\GraphQL\Execution\Visitor\MaxComplexityQueryVisitor(1000); // arbitrarily high cost
480
        $processor->processPayload('{ union(type: "object2") { ... on Object1 { id }, ... on Object2 { name } } }', [], [$visitor]);
481
        $this->assertEquals(10 + 13 + 1, $visitor->getMemo());
482
    }
483
484
    public function testComplexityReducer() {
485
      $schema = new Schema(
486
          [
487
              'query' => new ObjectType(
488
                  [
489
                      'name'   => 'RootQuery',
490
                      'fields' => [
491
                          'me' => [
492
                              'type'    => new ObjectType(
493
                                  [
494
                                      'name'   => 'User',
495
                                      'fields' => [
496
                                          'firstName' => [
497
                                              'type'    => new StringType(),
498
                                              'args'    => [
499
                                                  'shorten' => new BooleanType()
500
                                              ],
501
                                              'resolve' => function ($value, $args) {
502
                                                return empty($args['shorten']) ? $value : $value;
503
                                              }
504
                                          ],
505
                                          'lastName'  => new StringType(),
506
                                          'code'      => new StringType(),
507
                                          'likes'     => [
508
                                              'type'    => new IntType(),
509
                                              'cost'    => 10,
510
                                              'resolve' => function () {
511
                                                return 42;
512
                                              }
513
                                          ]
514
                                      ]
515
                                  ]
516
                              ),
517
                              'cost' => function ($args, $context, $childCost) {
518
                                $argsCost = isset($args['cost']) ? $args['cost'] : 1;
519
                                return 1 + $argsCost * $childCost;
520
                              },
521
                              'resolve' => function ($value, $args) {
0 ignored issues
show
Unused Code introduced by
The parameter $value is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
Unused Code introduced by
The parameter $args is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
522
                                $data = ['firstName' => 'John', 'code' => '007'];
523
524
                                return $data;
525
                              },
526
                              'args'    => [
527
                                  'cost' => [
528
                                      'type'    => new IntType(),
529
                                      'default' => 1
530
                                  ]
531
                              ]
532
                          ]
533
                      ]
534
                  ]
535
              )
536
          ]
537
      );
538
      $processor = new Processor($schema);
539
540
      $processor->setMaxComplexity(10);
541
542
      $processor->processPayload('{ me { firstName, lastName } }');
543
      $this->assertArrayNotHasKey('error', $processor->getResponseData());
544
545
      $processor->processPayload('{ me { firstName, likes } }');
546
      $this->assertEquals(['errors' => [['message' => 'query exceeded max allowed complexity of 10']]], $processor->getResponseData());
547
548
      // don't let complexity reducer affect query errors
549
      $processor->processPayload('{ me { badfield } }');
550
      $this->assertArraySubset(['errors' => [['message' => 'Field "badfield" not found in type "User"']]], $processor->getResponseData());
551
552
      foreach (range(1,5) as $cost_multiplier) {
553
        $visitor = new \Youshido\GraphQL\Execution\Visitor\MaxComplexityQueryVisitor(1000); // arbitrarily high cost
554
        $processor->processPayload("{ me (cost: $cost_multiplier) { firstName, lastName, code, likes } }", ['cost' => $cost_multiplier], [$visitor]);
555
        $expected = 1 + 13 * (1 + $cost_multiplier);
556
        $this->assertEquals($expected, $visitor->getMemo());
557
      }
558
559
      // TODO, variables not yet supported
560
      /*$query = 'query costQuery ($cost: Int) { me (cost: $cost) { firstName, lastName, code, likes } }';
0 ignored issues
show
Unused Code Comprehensibility introduced by
59% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
561
      foreach (range(1,5) as $cost_multiplier) {
562
        $visitor = new \Youshido\GraphQL\Execution\Visitor\MaxComplexityQueryVisitor(1000); // arbitrarily high cost
563
        $processor->processPayload($query, ['cost' => $cost_multiplier], [$visitor]);
564
        $expected = 1 + 13 * (1 + $cost_multiplier);
565
        $this->assertEquals($expected, $visitor->getMemo());
566
      }*/
567
    }
568
}
569