44
55namespace Jerowork \GraphqlAttributeSchema \Test \TypeResolver ;
66
7+ use DateTimeImmutable ;
78use Jerowork \GraphqlAttributeSchema \Parser \Ast ;
89use Jerowork \GraphqlAttributeSchema \Parser \Node \Child \ArgNode ;
910use Jerowork \GraphqlAttributeSchema \Parser \Node \Child \FieldNode ;
1011use Jerowork \GraphqlAttributeSchema \Parser \Node \Child \FieldNodeType ;
1112use Jerowork \GraphqlAttributeSchema \Parser \Node \InputTypeNode ;
1213use Jerowork \GraphqlAttributeSchema \Parser \Node \MutationNode ;
14+ use Jerowork \GraphqlAttributeSchema \Parser \Node \ScalarNode ;
1315use Jerowork \GraphqlAttributeSchema \Parser \Node \Type ;
1416use Jerowork \GraphqlAttributeSchema \Test \Doubles \Container \TestContainer ;
1517use Jerowork \GraphqlAttributeSchema \Test \Doubles \InputType \TestResolvableInputType ;
1618use Jerowork \GraphqlAttributeSchema \Test \Doubles \InputType \TestSmallInputType ;
1719use Jerowork \GraphqlAttributeSchema \Test \Doubles \Mutation \TestResolvableMutation ;
20+ use Jerowork \GraphqlAttributeSchema \Type \DateTimeType ;
1821use Jerowork \GraphqlAttributeSchema \TypeResolver \ResolveException ;
1922use Jerowork \GraphqlAttributeSchema \TypeResolver \RootTypeResolver ;
2023use PHPUnit \Framework \Attributes \Test ;
@@ -136,6 +139,12 @@ public function itShouldResolve(): void
136139 null ,
137140 'smallInputs ' ,
138141 ),
142+ new ArgNode (
143+ Type::createObject (DateTimeImmutable::class),
144+ 'dateTime ' ,
145+ null ,
146+ 'dateTime ' ,
147+ ),
139148 ],
140149 Type::createScalar ('string ' ),
141150 '__invoke ' ,
@@ -167,6 +176,16 @@ public function itShouldResolve(): void
167176 'parentNames ' ,
168177 null ,
169178 ),
179+ new FieldNode (
180+ Type::createObject (DateTimeImmutable::class),
181+ 'date ' ,
182+ null ,
183+ [],
184+ FieldNodeType::Property,
185+ null ,
186+ 'date ' ,
187+ null ,
188+ ),
170189 ],
171190 ),
172191 new InputTypeNode (
@@ -186,6 +205,12 @@ public function itShouldResolve(): void
186205 ),
187206 ],
188207 ),
208+ new ScalarNode (
209+ DateTimeType::class,
210+ 'DateTime ' ,
211+ null ,
212+ DateTimeImmutable::class,
213+ ),
189214 ),
190215 );
191216
@@ -196,13 +221,15 @@ public function itShouldResolve(): void
196221 'input ' => [
197222 'name ' => 'Foobar ' ,
198223 'parentNames ' => ['John ' , 'Jane ' ],
224+ 'date ' => new DateTimeImmutable ('2025-01-05 12:23:00 ' ),
199225 ],
200226 'userIds ' => ['1 ' , '2 ' , '3 ' ],
201227 'smallInputs ' => [
202228 ['id ' => '4 ' ],
203229 ['id ' => '5 ' ],
204230 ['id ' => '6 ' ],
205231 ],
232+ 'dateTime ' => new DateTimeImmutable ('2024-12-31 12:00:12 ' ),
206233 ]),
207234 );
208235 }
0 commit comments