File tree Expand file tree Collapse file tree 3 files changed +73
-1
lines changed
Fixtures/InputOutputNameConflict Expand file tree Collapse file tree 3 files changed +73
-1
lines changed Original file line number Diff line number Diff line change 1+ <?php
2+
3+
4+ namespace TheCodingMachine \GraphQLite \Fixtures \InputOutputNameConflict \Controllers ;
5+
6+
7+ use TheCodingMachine \GraphQLite \Annotations \Query ;
8+ use TheCodingMachine \GraphQLite \Annotations \UseInputType ;
9+ use TheCodingMachine \GraphQLite \Fixtures \InputOutputNameConflict \Types \InAndOut ;
10+
11+ class InAndOutController
12+ {
13+ /**
14+ * @Query()
15+ * @UseInputType(for="$inAndOut", inputType="InAndOut")
16+ */
17+ public function testInAndOut (InAndOut $ inAndOut ): InAndOut
18+ {
19+ return $ inAndOut ;
20+ }
21+ }
Original file line number Diff line number Diff line change 1+ <?php
2+
3+
4+ namespace TheCodingMachine \GraphQLite \Fixtures \InputOutputNameConflict \Types ;
5+
6+ use TheCodingMachine \GraphQLite \Annotations \Factory ;
7+ use TheCodingMachine \GraphQLite \Annotations \Field ;
8+ use TheCodingMachine \GraphQLite \Annotations \Type ;
9+
10+ /**
11+ * @Type(name="InAndOut")
12+ */
13+ class InAndOut
14+ {
15+ /**
16+ * @var string
17+ */
18+ private $ value ;
19+
20+ public function __construct (string $ value )
21+ {
22+ $ this ->value = $ value ;
23+ }
24+
25+ /**
26+ * @Field()
27+ */
28+ public function getValue (): string
29+ {
30+ return $ this ->value ;
31+ }
32+
33+ /**
34+ * @Factory(name="InAndOut")
35+ */
36+ public static function create (string $ value ): self
37+ {
38+ return new self ($ value );
39+ }
40+ }
Original file line number Diff line number Diff line change 5252use TheCodingMachine \GraphQLite \Containers \EmptyContainer ;
5353use TheCodingMachine \GraphQLite \Reflection \CachedDocBlockFactory ;
5454use TheCodingMachine \GraphQLite \Schema ;
55+ use TheCodingMachine \GraphQLite \SchemaFactory ;
5556use TheCodingMachine \GraphQLite \Security \AuthenticationServiceInterface ;
5657use TheCodingMachine \GraphQLite \Security \AuthorizationServiceInterface ;
5758use TheCodingMachine \GraphQLite \Security \SecurityExpressionLanguageProvider ;
@@ -451,7 +452,7 @@ public function testEndToEndInputType()
451452 {
452453 name: "bar"
453454 }
454- ]
455+ ]
455456 }
456457 ) {
457458 name,
@@ -1364,4 +1365,14 @@ public function getUser(): ?object
13641365
13651366 $ this ->assertSame (42 , $ result ->toArray (Debug::RETHROW_UNSAFE_EXCEPTIONS )['data ' ]['injectedUser ' ]);
13661367 }
1368+
1369+ public function testInputOutputNameConflict (): void
1370+ {
1371+ $ schemaFactory = new SchemaFactory (new Psr16Cache (new ArrayAdapter ()), new BasicAutoWiringContainer (new EmptyContainer ()));
1372+ $ schemaFactory ->addControllerNamespace ('TheCodingMachine \\GraphQLite \\Fixtures \\InputOutputNameConflict \\Controllers ' );
1373+ $ schemaFactory ->addTypeNamespace ('TheCodingMachine \\GraphQLite \\Fixtures \\InputOutputNameConflict \\Types ' );
1374+
1375+ $ schema = $ schemaFactory ->createSchema ();
1376+ $ schema ->validate ();
1377+ }
13671378}
You can’t perform that action at this time.
0 commit comments