77use GraphQL \GraphQL ;
88use GraphQL \Tests \TestCaseBase ;
99use GraphQL \Tests \Type \PhpEnumType \DocBlockPhpEnum ;
10+ use GraphQL \Tests \Type \PhpEnumType \IntPhpEnum ;
1011use GraphQL \Tests \Type \PhpEnumType \MultipleDeprecationsPhpEnum ;
1112use GraphQL \Tests \Type \PhpEnumType \MultipleDescriptionsCasePhpEnum ;
1213use GraphQL \Tests \Type \PhpEnumType \MultipleDescriptionsPhpEnum ;
@@ -31,42 +32,45 @@ protected function setUp(): void
3132 public function testConstructEnumTypeFromPhpEnum (): void
3233 {
3334 $ enumType = new PhpEnumType (PhpEnum::class);
34- self ::assertSame (
35- <<<'GRAPHQL'
35+ self ::assertSame (<<<'GRAPHQL'
3636"foo"
3737enum PhpEnum {
3838 "bar"
3939 A
4040 B @deprecated
4141 C @deprecated(reason: "baz")
4242}
43- GRAPHQL,
44- SchemaPrinter::printType ($ enumType )
45- );
43+ GRAPHQL, SchemaPrinter::printType ($ enumType ));
44+ }
45+
46+ public function testConstructEnumTypeFromIntPhpEnum (): void
47+ {
48+ $ enumType = new PhpEnumType (IntPhpEnum::class);
49+ self ::assertSame (<<<'GRAPHQL'
50+ enum IntPhpEnum {
51+ A
52+ }
53+ GRAPHQL, SchemaPrinter::printType ($ enumType ));
4654 }
4755
4856 public function testConstructEnumTypeFromPhpEnumWithCustomName (): void
4957 {
5058 $ enumType = new PhpEnumType (PhpEnum::class, 'CustomNamedPhpEnum ' );
51- self ::assertSame (
52- <<<'GRAPHQL'
59+ self ::assertSame (<<<'GRAPHQL'
5360"foo"
5461enum CustomNamedPhpEnum {
5562 "bar"
5663 A
5764 B @deprecated
5865 C @deprecated(reason: "baz")
5966}
60- GRAPHQL,
61- SchemaPrinter::printType ($ enumType )
62- );
67+ GRAPHQL, SchemaPrinter::printType ($ enumType ));
6368 }
6469
6570 public function testConstructEnumTypeFromPhpEnumWithDocBlockDescriptions (): void
6671 {
6772 $ enumType = new PhpEnumType (DocBlockPhpEnum::class);
68- self ::assertSame (
69- <<<'GRAPHQL'
73+ self ::assertSame (<<<'GRAPHQL'
7074"foo"
7175enum DocBlockPhpEnum {
7276 "preferred"
@@ -78,9 +82,7 @@ enum DocBlockPhpEnum {
7882 """
7983 B
8084}
81- GRAPHQL,
82- SchemaPrinter::printType ($ enumType )
83- );
85+ GRAPHQL, SchemaPrinter::printType ($ enumType ));
8486 }
8587
8688 public function testMultipleDescriptionsDisallowed (): void
@@ -126,14 +128,11 @@ public function testExecutesWithEnumTypeFromPhpEnum(): void
126128 ]),
127129 ]);
128130
129- self ::assertSame (
130- [
131- 'data ' => [
132- 'foo ' => 'A ' ,
133- ],
131+ self ::assertSame ([
132+ 'data ' => [
133+ 'foo ' => 'A ' ,
134134 ],
135- GraphQL::executeQuery ($ schema , '{ foo(bar: A) } ' )->toArray ()
136- );
135+ ], GraphQL::executeQuery ($ schema , '{ foo(bar: A) } ' )->toArray ());
137136 }
138137
139138 public function testFailsToSerializeNonEnum (): void
0 commit comments