Skip to content

Commit 677a3b7

Browse files
authored
Tests with enum input for mutation (#535)
* psr/container v2 * Implement replacement for Picotainer * Replace Picotainer with LazyContainer in tests and documentation for version >=6 * Fix tests for phpdocumentor/type-resolver minor update * run cs-fix script * Fix some cs-fixer errors manually * fix return type * abandon psr/container ^1 * Test for LazyContainer * Normalize RootTypeMapperInterface * end-to-end test with enums in mutation and as single-returned field
1 parent 4fdca6e commit 677a3b7

File tree

4 files changed

+367
-448
lines changed

4 files changed

+367
-448
lines changed

tests/Fixtures81/Integration/Controllers/ButtonController.php

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,30 @@
44

55
namespace TheCodingMachine\GraphQLite\Fixtures81\Integration\Controllers;
66

7+
use TheCodingMachine\GraphQLite\Annotations\Mutation;
78
use TheCodingMachine\GraphQLite\Annotations\Query;
89
use TheCodingMachine\GraphQLite\Fixtures81\Integration\Models\Button;
910
use TheCodingMachine\GraphQLite\Fixtures81\Integration\Models\Color;
1011
use TheCodingMachine\GraphQLite\Fixtures81\Integration\Models\Position;
1112
use TheCodingMachine\GraphQLite\Fixtures81\Integration\Models\Size;
1213

13-
class ButtonController
14+
final class ButtonController
1415
{
15-
/**
16-
* @Query()
17-
*/
16+
#[Query]
1817
public function getButton(Color $color, Size $size, Position $state): Button
1918
{
2019
return new Button($color, $size, $state);
2120
}
21+
22+
#[Mutation]
23+
public function updateButton(Color $color, Size $size, Position $state): Button
24+
{
25+
return new Button($color, $size, $state);
26+
}
27+
28+
#[Mutation]
29+
public function singleEnum(Size $size): Size
30+
{
31+
return $size;
32+
}
2233
}

tests/Fixtures81/Integration/Models/Position.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,7 @@
66

77
use TheCodingMachine\GraphQLite\Annotations\Type;
88

9-
/**
10-
* @Type
11-
*/
9+
#[Type]
1210
enum Position: int
1311
{
1412
case Off = 0;

tests/Fixtures81/Integration/Models/Size.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,7 @@
66

77
use TheCodingMachine\GraphQLite\Annotations\Type;
88

9-
/**
10-
* @Type
11-
*/
9+
#[Type]
1210
enum Size
1311
{
1412
case S;

0 commit comments

Comments
 (0)