File tree Expand file tree Collapse file tree 2 files changed +9
-2
lines changed Expand file tree Collapse file tree 2 files changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -41,6 +41,7 @@ You can find and compare releases at the [GitHub release page](https://github.co
41
41
- Add validation rule ` UniqueEnumValueNames `
42
42
- Add SDL validation rule ` UniqueOperationTypes ` (#995 )
43
43
- Add ability to remove custom validation rules after adding them via ` DocumentValidator::removeRule() `
44
+ - Allow lazy enum values
44
45
45
46
### Optimized
46
47
Original file line number Diff line number Diff line change @@ -685,10 +685,16 @@ public function testLazilyDefineValuesAsCallable(): void
685
685
686
686
$ schema = new Schema (['query ' => $ QueryType ]);
687
687
688
+ self ::assertSame (0 , $ called , 'Should not eagerly call enum values during schema construction ' );
689
+
690
+ $ query = '{ colorEnum(fromEnum: RED) } ' ;
688
691
self ::assertEquals (
689
692
['data ' => ['colorEnum ' => 'RED ' ]],
690
- GraphQL::executeQuery ($ schema , ' { colorEnum(fromEnum: RED) } ' )->toArray ()
693
+ GraphQL::executeQuery ($ schema , $ query )->toArray ()
691
694
);
692
- self ::assertSame (1 , $ called );
695
+ GraphQL::executeQuery ($ schema , $ query );
696
+
697
+ // @phpstan-ignore-next-line $called is mutated
698
+ self ::assertSame (1 , $ called , 'Should call enum values callable exactly once ' );
693
699
}
694
700
}
You can’t perform that action at this time.
0 commit comments