File tree Expand file tree Collapse file tree 3 files changed +61
-1
lines changed
Doubles/FullFeatured/Query Expand file tree Collapse file tree 3 files changed +61
-1
lines changed Original file line number Diff line number Diff line change 1+ <?php
2+
3+ declare (strict_types=1 );
4+
5+ namespace Jerowork \GraphqlAttributeSchema \Test \Doubles \FullFeatured \Query ;
6+
7+ use Jerowork \GraphqlAttributeSchema \Attribute \Arg ;
8+ use Jerowork \GraphqlAttributeSchema \Attribute \Option \ListType ;
9+ use Jerowork \GraphqlAttributeSchema \Attribute \Option \ScalarType ;
10+ use Jerowork \GraphqlAttributeSchema \Attribute \Query ;
11+ use DateTimeImmutable ;
12+
13+ #[Query(name: 'getFoobar ' , type: new ListType (ScalarType::String))]
14+ final readonly class FoobarQuery
15+ {
16+ /**
17+ * @param list<bool> $values
18+ *
19+ * @return list<string>
20+ */
21+ public function __invoke (
22+ int $ id ,
23+ DateTimeImmutable $ date ,
24+ #[Arg(type: new ListType (ScalarType::Bool))]
25+ array $ values ,
26+ ): array {
27+ return [];
28+ }
29+ }
Original file line number Diff line number Diff line change 2424use Jerowork \GraphqlAttributeSchema \Parser \NodeParser \TypeNodeParser ;
2525use Jerowork \GraphqlAttributeSchema \Parser \Parser ;
2626use Jerowork \GraphqlAttributeSchema \Test \Doubles \FullFeatured \Mutation \FoobarMutation ;
27+ use Jerowork \GraphqlAttributeSchema \Test \Doubles \FullFeatured \Query \FoobarQuery ;
2728use Jerowork \GraphqlAttributeSchema \Test \Doubles \FullFeatured \Type \FoobarStatusType ;
2829use Jerowork \GraphqlAttributeSchema \Test \Doubles \FullFeatured \Type \FoobarType ;
2930use Jerowork \GraphqlAttributeSchema \Test \Doubles \FullFeatured \Type \Input \Baz ;
@@ -83,7 +84,36 @@ public function it_should_parse_directory(): void
8384 ),
8485 ], $ ast ->getNodesByNodeType (MutationNode::class));
8586
86- self ::assertEquals ([], $ ast ->getNodesByNodeType (QueryNode::class));
87+ self ::assertEquals ([
88+ new QueryNode (
89+ FoobarQuery::class,
90+ 'getFoobar ' ,
91+ null ,
92+ [
93+ new ArgNode (
94+ Type::createScalar ('int ' ),
95+ 'id ' ,
96+ null ,
97+ 'id ' ,
98+ ),
99+ new ArgNode (
100+ Type::createObject (DateTimeImmutable::class),
101+ 'date ' ,
102+ null ,
103+ 'date ' ,
104+ ),
105+ new ArgNode (
106+ Type::createScalar ('bool ' )->setList (),
107+ 'values ' ,
108+ null ,
109+ 'values ' ,
110+ ),
111+ ],
112+ Type::createScalar ('string ' )->setList (),
113+ '__invoke ' ,
114+ null ,
115+ ),
116+ ], $ ast ->getNodesByNodeType (QueryNode::class));
87117
88118 self ::assertEquals ([
89119 new InputTypeNode (
Original file line number Diff line number Diff line change @@ -38,6 +38,7 @@ public function itShouldRetrieveFilesFromFolder(): void
3838
3939 self ::assertSame ([
4040 'Doubles/FullFeatured/Mutation/FoobarMutation.php ' ,
41+ 'Doubles/FullFeatured/Query/FoobarQuery.php ' ,
4142 'Doubles/FullFeatured/Type/FoobarStatusType.php ' ,
4243 'Doubles/FullFeatured/Type/FoobarType.php ' ,
4344 'Doubles/FullFeatured/Type/Input/Baz.php ' ,
You can’t perform that action at this time.
0 commit comments