|
20 | 20 | final class SpyValidationCacheAdapter extends PsrValidationCacheAdapter |
21 | 21 | { |
22 | 22 | public int $isValidatedCalls = 0; |
| 23 | + |
23 | 24 | public int $markValidatedCalls = 0; |
24 | 25 |
|
25 | 26 | public function isValidated(Schema $schema, DocumentNode $ast): bool |
26 | 27 | { |
27 | | - $this->isValidatedCalls++; |
| 28 | + ++$this->isValidatedCalls; |
| 29 | + |
28 | 30 | return parent::isValidated($schema, $ast); |
29 | 31 | } |
30 | 32 |
|
31 | 33 | public function markValidated(Schema $schema, DocumentNode $ast): void |
32 | 34 | { |
33 | | - $this->markValidatedCalls++; |
| 35 | + ++$this->markValidatedCalls; |
34 | 36 | parent::markValidated($schema, $ast); |
35 | 37 | } |
36 | 38 | } |
37 | 39 |
|
38 | | - |
39 | 40 | final class ValidationWithCacheTest extends TestCase |
40 | 41 | { |
41 | 42 | use ArraySubsetAsserts; |
@@ -99,8 +100,8 @@ public function testIsValidationCachedWithAdapter(): void |
99 | 100 | }'; |
100 | 101 |
|
101 | 102 | // make the same call twice in a row. We'll then inspect the cache object to count calls |
102 | | - GraphQL::executeQuery( $schema, $query, null, null, null, null, null, null, $cache)->toArray(); |
103 | | - $result = GraphQL::executeQuery( $schema, $query, null, null, null, null, null, null, $cache)->toArray(); |
| 103 | + GraphQL::executeQuery($schema, $query, null, null, null, null, null, null, $cache)->toArray(); |
| 104 | + $result = GraphQL::executeQuery($schema, $query, null, null, null, null, null, null, $cache)->toArray(); |
104 | 105 |
|
105 | 106 | // ✅ Assert that validation only happened once |
106 | 107 | self::assertEquals(2, $cache->isValidatedCalls, 'Should check cache twice'); |
|
0 commit comments