Skip to content

Commit 0880b3a

Browse files
committed
Adding failing test for enums
1 parent d92271b commit 0880b3a

File tree

2 files changed

+31
-0
lines changed

2 files changed

+31
-0
lines changed

tests/Fixtures/Integration/Controllers/ProductController.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,14 @@ public function echoProductType(ProductTypeEnum $productType): ProductTypeEnum
5151
return $productType;
5252
}
5353

54+
/**
55+
* @Query()
56+
*/
57+
public function echoSomeProductType(): ProductTypeEnum
58+
{
59+
return ProductTypeEnum::FOOD();
60+
}
61+
5462
/**
5563
* @Query()
5664
*/

tests/Integration/EndToEndTest.php

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -934,6 +934,29 @@ public function testEndToEndEnums(): void
934934
], $result->toArray(Debug::RETHROW_INTERNAL_EXCEPTIONS)['data']);
935935
}
936936

937+
public function testEndToEndEnums2(): void
938+
{
939+
/**
940+
* @var Schema $schema
941+
*/
942+
$schema = $this->mainContainer->get(Schema::class);
943+
944+
$queryString = '
945+
query {
946+
echoSomeProductType
947+
}
948+
';
949+
950+
$result = GraphQL::executeQuery(
951+
$schema,
952+
$queryString
953+
);
954+
955+
$this->assertSame([
956+
'echoProductType' => 'FOOD'
957+
], $result->toArray(Debug::RETHROW_INTERNAL_EXCEPTIONS)['data']);
958+
}
959+
937960
public function testEndToEndDateTime(): void
938961
{
939962
/**

0 commit comments

Comments
 (0)