1414use Mouf \Picotainer \Picotainer ;
1515use Psr \Container \ContainerInterface ;
1616use Symfony \Component \Cache \Simple \NullCache ;
17- use TheCodingMachine \GraphQL \ Controllers \AnnotationReader ;
17+ use TheCodingMachine \GraphQLite \AnnotationReader ;
1818use Doctrine \Common \Annotations \AnnotationReader as DoctrineAnnotationReader ;
19- use TheCodingMachine \GraphQL \Controllers \Containers \BasicAutoWiringContainer ;
20- use TheCodingMachine \GraphQL \Controllers \FieldsBuilderFactory ;
21- use TheCodingMachine \GraphQL \Controllers \Hydrators \FactoryHydrator ;
22- use TheCodingMachine \GraphQL \Controllers \Hydrators \HydratorInterface ;
23- use TheCodingMachine \GraphQL \Controllers \InputTypeGenerator ;
24- use TheCodingMachine \GraphQL \Controllers \InputTypeUtils ;
25- use TheCodingMachine \GraphQL \Controllers \Mappers \GlobTypeMapper ;
26- use TheCodingMachine \GraphQL \Controllers \Mappers \RecursiveTypeMapper ;
27- use TheCodingMachine \GraphQL \Controllers \Mappers \RecursiveTypeMapperInterface ;
28- use TheCodingMachine \GraphQL \Controllers \Mappers \TypeMapperInterface ;
29- use TheCodingMachine \GraphQL \Controllers \NamingStrategy ;
30- use TheCodingMachine \GraphQL \Controllers \Reflection \CachedDocBlockFactory ;
31- use TheCodingMachine \GraphQL \Controllers \Security \AuthenticationServiceInterface ;
32- use TheCodingMachine \GraphQL \Controllers \Security \AuthorizationServiceInterface ;
33- use TheCodingMachine \GraphQL \Controllers \Security \VoidAuthenticationService ;
34- use TheCodingMachine \GraphQL \Controllers \Security \VoidAuthorizationService ;
35- use TheCodingMachine \GraphQL \Controllers \TypeGenerator ;
36- use TheCodingMachine \GraphQL \Controllers \Types \TypeResolver ;
19+ use TheCodingMachine \GraphQLite \Containers \BasicAutoWiringContainer ;
20+ use TheCodingMachine \GraphQLite \FieldsBuilderFactory ;
21+ use TheCodingMachine \GraphQLite \Hydrators \FactoryHydrator ;
22+ use TheCodingMachine \GraphQLite \Hydrators \HydratorInterface ;
23+ use TheCodingMachine \GraphQLite \InputTypeGenerator ;
24+ use TheCodingMachine \GraphQLite \InputTypeUtils ;
25+ use TheCodingMachine \GraphQLite \Mappers \GlobTypeMapper ;
26+ use TheCodingMachine \GraphQLite \Mappers \RecursiveTypeMapper ;
27+ use TheCodingMachine \GraphQLite \Mappers \RecursiveTypeMapperInterface ;
28+ use TheCodingMachine \GraphQLite \Mappers \TypeMapperInterface ;
29+ use TheCodingMachine \GraphQLite \NamingStrategy ;
30+ use TheCodingMachine \GraphQLite \Reflection \CachedDocBlockFactory ;
31+ use TheCodingMachine \GraphQLite \Security \AuthenticationServiceInterface ;
32+ use TheCodingMachine \GraphQLite \Security \AuthorizationServiceInterface ;
33+ use TheCodingMachine \GraphQLite \Security \VoidAuthenticationService ;
34+ use TheCodingMachine \GraphQLite \Security \VoidAuthorizationService ;
35+ use TheCodingMachine \GraphQLite \TypeGenerator ;
36+ use TheCodingMachine \GraphQLite \TypeRegistry ;
37+ use TheCodingMachine \GraphQLite \Types \TypeResolver ;
3738use TheCodingMachine \TDBM \Configuration ;
3839use TheCodingMachine \Tdbm \GraphQL \Registry \EmptyContainer ;
3940use TheCodingMachine \Tdbm \GraphQL \Tests \Beans \Country ;
4344use TheCodingMachine \Tdbm \GraphQL \Tests \GraphQL \CountryType ;
4445use TheCodingMachine \Tdbm \GraphQL \Tests \GraphQL \Generated \AbstractCountryType ;
4546use TheCodingMachine \Tdbm \GraphQL \Tests \GraphQL \Generated \AbstractUserType ;
46- use TheCodingMachine \Tdbm \GraphQL \Tests \GraphQL \TdbmGraphQLTypeMapper ;
4747use TheCodingMachine \Tdbm \GraphQL \Tests \GraphQL \UserType ;
4848use TheCodingMachine \TDBM \TDBMService ;
4949use TheCodingMachine \TDBM \Utils \DefaultNamingStrategy as TdbmDefaultNamingStrategy ;
5050use PHPUnit \Framework \TestCase ;
51- use Youshido \GraphQL \Execution \Context \ExecutionContext ;
52- use Youshido \GraphQL \Execution \Processor ;
53- use Youshido \GraphQL \Execution \ResolveInfo ;
5451use GraphQL \Type \Schema ;
55- use Youshido \GraphQL \Type \Scalar \StringType ;
5652
5753class GraphQLTypeGeneratorTest extends TestCase
5854{
@@ -71,7 +67,8 @@ public function setUp()
7167 $ container ->get (AuthenticationServiceInterface::class),
7268 $ container ->get (AuthorizationServiceInterface::class),
7369 $ container ->get (TypeResolver::class),
74- $ container ->get (CachedDocBlockFactory::class)
70+ $ container ->get (CachedDocBlockFactory::class),
71+ $ container ->get (NamingStrategyInterface::class)
7572 );
7673 },
7774 BasicAutoWiringContainer::class => function (ContainerInterface $ container ) {
@@ -84,7 +81,12 @@ public function setUp()
8481 return new VoidAuthenticationService ();
8582 },
8683 RecursiveTypeMapperInterface::class => function (ContainerInterface $ container ) {
87- return new RecursiveTypeMapper ($ container ->get (TypeMapperInterface::class), $ container ->get (NamingStrategyInterface::class), new \Symfony \Component \Cache \Simple \ArrayCache ());
84+ return new RecursiveTypeMapper (
85+ $ container ->get (TypeMapperInterface::class),
86+ $ container ->get (NamingStrategyInterface::class),
87+ new \Symfony \Component \Cache \Simple \ArrayCache (),
88+ $ container ->get (TypeRegistry::class)
89+ );
8890 },
8991 TypeMapperInterface::class => function (ContainerInterface $ container ) {
9092 return new GlobTypeMapper (
@@ -102,9 +104,14 @@ public function setUp()
102104 return new TypeGenerator (
103105 $ container ->get (AnnotationReader::class),
104106 $ container ->get (FieldsBuilderFactory::class),
105- $ container ->get (NamingStrategyInterface::class)
107+ $ container ->get (NamingStrategyInterface::class),
108+ $ container ->get (TypeRegistry::class),
109+ $ container ->get (BasicAutoWiringContainer::class)
106110 );
107111 },
112+ TypeRegistry::class => function () {
113+ return new TypeRegistry ();
114+ },
108115 AnnotationReader::class => function (ContainerInterface $ container ) {
109116 return new AnnotationReader (new DoctrineAnnotationReader ());
110117 },
@@ -223,7 +230,7 @@ public function testQuery()
223230 'name ' => 'Query ' ,
224231 'fields ' => [
225232 'users ' => [
226- 'type ' => Type::listOf ($ this ->mainContainer ->get (RecursiveTypeMapperInterface::class)->mapClassToType (User::class)),
233+ 'type ' => Type::listOf ($ this ->mainContainer ->get (RecursiveTypeMapperInterface::class)->mapClassToType (User::class, null )),
227234 'resolve ' => function () use ($ userDao ) {
228235 return $ userDao ->findAll ();
229236 }
@@ -319,7 +326,7 @@ private function recursiveDelete(string $str) : bool
319326
320327 public function testResultIteratorType ()
321328 {
322- $ type = new ResultIteratorType ($ this ->mainContainer ->get (RecursiveTypeMapperInterface::class)->mapClassToType (Country::class));
329+ $ type = new ResultIteratorType ($ this ->mainContainer ->get (RecursiveTypeMapperInterface::class)->mapClassToType (Country::class, null ));
323330
324331 $ tdbmService = self ::getTDBMService ();
325332 $ countryDao = new CountryDao ($ tdbmService );
0 commit comments