Skip to content

Commit 9ee9c56

Browse files
authored
Merge pull request #25 from moufmouf/graphqlite
Migrating to graphqlite
2 parents d0b3002 + 837dad7 commit 9ee9c56

File tree

6 files changed

+47
-40
lines changed

6 files changed

+47
-40
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"thecodingmachine/tdbm": "^5.0",
1313
"symfony/filesystem": "^2.0 || ^3.0",
1414
"psr/container": "^1.0",
15-
"thecodingmachine/graphql-controllers": "^3"
15+
"thecodingmachine/graphqlite": "^3"
1616
},
1717
"require-dev": {
1818
"phpunit/phpunit": "^6.1",

src/Field.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
namespace TheCodingMachine\Tdbm\GraphQL;
55

66
use GraphQL\Type\Definition\OutputType;
7-
use TheCodingMachine\GraphQL\Controllers\Annotations\Right;
8-
use TheCodingMachine\GraphQL\Controllers\Annotations\SourceFieldInterface;
7+
use TheCodingMachine\GraphQLite\Annotations\Right;
8+
use TheCodingMachine\GraphQLite\Annotations\SourceFieldInterface;
99
use TheCodingMachine\Tdbm\GraphQL\Registry\Registry;
1010

1111
class Field implements SourceFieldInterface

src/GraphQLTypeGenerator.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,8 +115,8 @@ private function generateAbstractTypeFile(BeanDescriptorInterface $beanDescripto
115115
<?php
116116
namespace {$this->generatedNamespace};
117117
118-
use TheCodingMachine\GraphQL\Controllers\Registry\RegistryInterface;
119-
use TheCodingMachine\GraphQL\Controllers\Annotations\Type;
118+
use TheCodingMachine\GraphQLite\Registry\RegistryInterface;
119+
use TheCodingMachine\GraphQLite\Annotations\Type;
120120
use TheCodingMachine\Tdbm\GraphQL\Field;
121121
use TheCodingMachine\Tdbm\GraphQL\TdbmObjectType;
122122

src/TdbmObjectType.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33

44
namespace TheCodingMachine\Tdbm\GraphQL;
55

6-
use TheCodingMachine\GraphQL\Controllers\AbstractAnnotatedObjectType;
7-
use TheCodingMachine\GraphQL\Controllers\Annotations\SourceFieldInterface;
8-
use TheCodingMachine\GraphQL\Controllers\FromSourceFieldsInterface;
6+
use TheCodingMachine\GraphQLite\AbstractAnnotatedObjectType;
7+
use TheCodingMachine\GraphQLite\Annotations\SourceFieldInterface;
8+
use TheCodingMachine\GraphQLite\FromSourceFieldsInterface;
99

1010
abstract class TdbmObjectType implements FromSourceFieldsInterface
1111
{

tests/FieldTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
namespace TheCodingMachine\Tdbm\GraphQL;
44

55
use PHPUnit\Framework\TestCase;
6-
use TheCodingMachine\GraphQL\Controllers\Registry\Registry;
7-
use TheCodingMachine\GraphQL\Controllers\Security\AuthorizationServiceInterface;
8-
use TheCodingMachine\GraphQL\Controllers\Security\VoidAuthenticationService;
6+
use TheCodingMachine\GraphQLite\Registry\Registry;
7+
use TheCodingMachine\GraphQLite\Security\AuthorizationServiceInterface;
8+
use TheCodingMachine\GraphQLite\Security\VoidAuthenticationService;
99
use TheCodingMachine\Tdbm\GraphQL\Registry\EmptyContainer;
1010
use Youshido\GraphQL\Type\Scalar\StringType;
1111

tests/GraphQLTypeGeneratorTest.php

Lines changed: 36 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -14,26 +14,27 @@
1414
use Mouf\Picotainer\Picotainer;
1515
use Psr\Container\ContainerInterface;
1616
use Symfony\Component\Cache\Simple\NullCache;
17-
use TheCodingMachine\GraphQL\Controllers\AnnotationReader;
17+
use TheCodingMachine\GraphQLite\AnnotationReader;
1818
use 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;
3738
use TheCodingMachine\TDBM\Configuration;
3839
use TheCodingMachine\Tdbm\GraphQL\Registry\EmptyContainer;
3940
use TheCodingMachine\Tdbm\GraphQL\Tests\Beans\Country;
@@ -43,16 +44,11 @@
4344
use TheCodingMachine\Tdbm\GraphQL\Tests\GraphQL\CountryType;
4445
use TheCodingMachine\Tdbm\GraphQL\Tests\GraphQL\Generated\AbstractCountryType;
4546
use TheCodingMachine\Tdbm\GraphQL\Tests\GraphQL\Generated\AbstractUserType;
46-
use TheCodingMachine\Tdbm\GraphQL\Tests\GraphQL\TdbmGraphQLTypeMapper;
4747
use TheCodingMachine\Tdbm\GraphQL\Tests\GraphQL\UserType;
4848
use TheCodingMachine\TDBM\TDBMService;
4949
use TheCodingMachine\TDBM\Utils\DefaultNamingStrategy as TdbmDefaultNamingStrategy;
5050
use PHPUnit\Framework\TestCase;
51-
use Youshido\GraphQL\Execution\Context\ExecutionContext;
52-
use Youshido\GraphQL\Execution\Processor;
53-
use Youshido\GraphQL\Execution\ResolveInfo;
5451
use GraphQL\Type\Schema;
55-
use Youshido\GraphQL\Type\Scalar\StringType;
5652

5753
class 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

Comments
 (0)