1717use TheCodingMachine \GraphQL \Controllers \AnnotationReader ;
1818use Doctrine \Common \Annotations \AnnotationReader as DoctrineAnnotationReader ;
1919use TheCodingMachine \GraphQL \Controllers \Containers \BasicAutoWiringContainer ;
20- use TheCodingMachine \GraphQL \Controllers \ControllerQueryProviderFactory ;
21- use TheCodingMachine \GraphQL \Controllers \HydratorInterface ;
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 ;
2225use TheCodingMachine \GraphQL \Controllers \Mappers \GlobTypeMapper ;
2326use TheCodingMachine \GraphQL \Controllers \Mappers \RecursiveTypeMapper ;
2427use TheCodingMachine \GraphQL \Controllers \Mappers \RecursiveTypeMapperInterface ;
2528use TheCodingMachine \GraphQL \Controllers \Mappers \TypeMapperInterface ;
29+ use TheCodingMachine \GraphQL \Controllers \NamingStrategy ;
30+ use TheCodingMachine \GraphQL \Controllers \Reflection \CachedDocBlockFactory ;
2631use TheCodingMachine \GraphQL \Controllers \Security \AuthenticationServiceInterface ;
2732use TheCodingMachine \GraphQL \Controllers \Security \AuthorizationServiceInterface ;
2833use TheCodingMachine \GraphQL \Controllers \Security \VoidAuthenticationService ;
2934use TheCodingMachine \GraphQL \Controllers \Security \VoidAuthorizationService ;
3035use TheCodingMachine \GraphQL \Controllers \TypeGenerator ;
36+ use TheCodingMachine \GraphQL \Controllers \Types \TypeResolver ;
3137use TheCodingMachine \TDBM \Configuration ;
3238use TheCodingMachine \Tdbm \GraphQL \Registry \EmptyContainer ;
33- use TheCodingMachine \Tdbm \GraphQL \Registry \Registry ;
3439use TheCodingMachine \Tdbm \GraphQL \Tests \Beans \Country ;
3540use TheCodingMachine \Tdbm \GraphQL \Tests \Beans \User ;
3641use TheCodingMachine \Tdbm \GraphQL \Tests \DAOs \CountryDao ;
@@ -59,13 +64,14 @@ class GraphQLTypeGeneratorTest extends TestCase
5964 public function setUp ()
6065 {
6166 $ this ->mainContainer = new Picotainer ([
62- ControllerQueryProviderFactory ::class => function (ContainerInterface $ container ) {
63- return new ControllerQueryProviderFactory (
67+ FieldsBuilderFactory ::class => function (ContainerInterface $ container ) {
68+ return new FieldsBuilderFactory (
6469 $ container ->get (AnnotationReader::class),
6570 $ container ->get (HydratorInterface::class),
6671 $ container ->get (AuthenticationServiceInterface::class),
6772 $ container ->get (AuthorizationServiceInterface::class),
68- $ container ->get (BasicAutoWiringContainer::class)
73+ $ container ->get (TypeResolver::class),
74+ $ container ->get (CachedDocBlockFactory::class)
6975 );
7076 },
7177 BasicAutoWiringContainer::class => function (ContainerInterface $ container ) {
@@ -78,35 +84,55 @@ public function setUp()
7884 return new VoidAuthenticationService ();
7985 },
8086 RecursiveTypeMapperInterface::class => function (ContainerInterface $ container ) {
81- return new RecursiveTypeMapper ($ container ->get (TypeMapperInterface::class));
87+ return new RecursiveTypeMapper ($ container ->get (TypeMapperInterface::class), $ container -> get (NamingStrategyInterface::class), new \ Symfony \ Component \ Cache \ Simple \ ArrayCache () );
8288 },
8389 TypeMapperInterface::class => function (ContainerInterface $ container ) {
8490 return new GlobTypeMapper (
8591 'TheCodingMachine \\Tdbm \\GraphQL \\Tests \\GraphQL ' ,
8692 $ container ->get (TypeGenerator::class),
93+ $ container ->get (InputTypeGenerator::class),
94+ $ container ->get (InputTypeUtils::class),
8795 $ container ->get (BasicAutoWiringContainer::class),
8896 $ container ->get (AnnotationReader::class),
89- new NullCache ()
97+ $ container ->get (NamingStrategyInterface::class),
98+ new \Symfony \Component \Cache \Simple \ArrayCache ()
9099 );
91100 },
92101 TypeGenerator::class => function (ContainerInterface $ container ) {
93102 return new TypeGenerator (
94103 $ container ->get (AnnotationReader::class),
95- $ container ->get (ControllerQueryProviderFactory::class)
104+ $ container ->get (FieldsBuilderFactory::class),
105+ $ container ->get (NamingStrategyInterface::class)
96106 );
97107 },
98108 AnnotationReader::class => function (ContainerInterface $ container ) {
99109 return new AnnotationReader (new DoctrineAnnotationReader ());
100110 },
101111 HydratorInterface::class => function (ContainerInterface $ container ) {
102- return new class implements HydratorInterface {
103- public function hydrate (array $ data , InputType $ type )
104- {
105- throw new \RuntimeException ('Not implemented ' );
106- //return new Contact($data['name']);
107- }
108- };
109- }
112+ return new FactoryHydrator ();
113+ },
114+ InputTypeGenerator::class => function (ContainerInterface $ container ) {
115+ return new InputTypeGenerator (
116+ $ container ->get (InputTypeUtils::class),
117+ $ container ->get (FieldsBuilderFactory::class),
118+ $ container ->get (HydratorInterface::class)
119+ );
120+ },
121+ InputTypeUtils::class => function (ContainerInterface $ container ) {
122+ return new InputTypeUtils (
123+ $ container ->get (AnnotationReader::class),
124+ $ container ->get (NamingStrategyInterface::class)
125+ );
126+ },
127+ TypeResolver::class => function (ContainerInterface $ container ) {
128+ return new TypeResolver ();
129+ },
130+ CachedDocBlockFactory::class => function () {
131+ return new CachedDocBlockFactory (new \Symfony \Component \Cache \Simple \ArrayCache ());
132+ },
133+ NamingStrategyInterface::class => function () {
134+ return new NamingStrategy ();
135+ },
110136 ]);
111137 }
112138
0 commit comments