Skip to content

Commit

Permalink
Merge 837dad7 into d0b3002
Browse files Browse the repository at this point in the history
  • Loading branch information
moufmouf committed Jan 29, 2019
2 parents d0b3002 + 837dad7 commit 28beecf
Show file tree
Hide file tree
Showing 6 changed files with 47 additions and 40 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"thecodingmachine/tdbm": "^5.0",
"symfony/filesystem": "^2.0 || ^3.0",
"psr/container": "^1.0",
"thecodingmachine/graphql-controllers": "^3"
"thecodingmachine/graphqlite": "^3"
},
"require-dev": {
"phpunit/phpunit": "^6.1",
Expand Down
4 changes: 2 additions & 2 deletions src/Field.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
namespace TheCodingMachine\Tdbm\GraphQL;

use GraphQL\Type\Definition\OutputType;
use TheCodingMachine\GraphQL\Controllers\Annotations\Right;
use TheCodingMachine\GraphQL\Controllers\Annotations\SourceFieldInterface;
use TheCodingMachine\GraphQLite\Annotations\Right;
use TheCodingMachine\GraphQLite\Annotations\SourceFieldInterface;
use TheCodingMachine\Tdbm\GraphQL\Registry\Registry;

class Field implements SourceFieldInterface
Expand Down
4 changes: 2 additions & 2 deletions src/GraphQLTypeGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,8 @@ private function generateAbstractTypeFile(BeanDescriptorInterface $beanDescripto
<?php
namespace {$this->generatedNamespace};
use TheCodingMachine\GraphQL\Controllers\Registry\RegistryInterface;
use TheCodingMachine\GraphQL\Controllers\Annotations\Type;
use TheCodingMachine\GraphQLite\Registry\RegistryInterface;
use TheCodingMachine\GraphQLite\Annotations\Type;
use TheCodingMachine\Tdbm\GraphQL\Field;
use TheCodingMachine\Tdbm\GraphQL\TdbmObjectType;
Expand Down
6 changes: 3 additions & 3 deletions src/TdbmObjectType.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@

namespace TheCodingMachine\Tdbm\GraphQL;

use TheCodingMachine\GraphQL\Controllers\AbstractAnnotatedObjectType;
use TheCodingMachine\GraphQL\Controllers\Annotations\SourceFieldInterface;
use TheCodingMachine\GraphQL\Controllers\FromSourceFieldsInterface;
use TheCodingMachine\GraphQLite\AbstractAnnotatedObjectType;
use TheCodingMachine\GraphQLite\Annotations\SourceFieldInterface;
use TheCodingMachine\GraphQLite\FromSourceFieldsInterface;

abstract class TdbmObjectType implements FromSourceFieldsInterface
{
Expand Down
6 changes: 3 additions & 3 deletions tests/FieldTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
namespace TheCodingMachine\Tdbm\GraphQL;

use PHPUnit\Framework\TestCase;
use TheCodingMachine\GraphQL\Controllers\Registry\Registry;
use TheCodingMachine\GraphQL\Controllers\Security\AuthorizationServiceInterface;
use TheCodingMachine\GraphQL\Controllers\Security\VoidAuthenticationService;
use TheCodingMachine\GraphQLite\Registry\Registry;
use TheCodingMachine\GraphQLite\Security\AuthorizationServiceInterface;
use TheCodingMachine\GraphQLite\Security\VoidAuthenticationService;
use TheCodingMachine\Tdbm\GraphQL\Registry\EmptyContainer;
use Youshido\GraphQL\Type\Scalar\StringType;

Expand Down
65 changes: 36 additions & 29 deletions tests/GraphQLTypeGeneratorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,26 +14,27 @@
use Mouf\Picotainer\Picotainer;
use Psr\Container\ContainerInterface;
use Symfony\Component\Cache\Simple\NullCache;
use TheCodingMachine\GraphQL\Controllers\AnnotationReader;
use TheCodingMachine\GraphQLite\AnnotationReader;
use Doctrine\Common\Annotations\AnnotationReader as DoctrineAnnotationReader;
use TheCodingMachine\GraphQL\Controllers\Containers\BasicAutoWiringContainer;
use TheCodingMachine\GraphQL\Controllers\FieldsBuilderFactory;
use TheCodingMachine\GraphQL\Controllers\Hydrators\FactoryHydrator;
use TheCodingMachine\GraphQL\Controllers\Hydrators\HydratorInterface;
use TheCodingMachine\GraphQL\Controllers\InputTypeGenerator;
use TheCodingMachine\GraphQL\Controllers\InputTypeUtils;
use TheCodingMachine\GraphQL\Controllers\Mappers\GlobTypeMapper;
use TheCodingMachine\GraphQL\Controllers\Mappers\RecursiveTypeMapper;
use TheCodingMachine\GraphQL\Controllers\Mappers\RecursiveTypeMapperInterface;
use TheCodingMachine\GraphQL\Controllers\Mappers\TypeMapperInterface;
use TheCodingMachine\GraphQL\Controllers\NamingStrategy;
use TheCodingMachine\GraphQL\Controllers\Reflection\CachedDocBlockFactory;
use TheCodingMachine\GraphQL\Controllers\Security\AuthenticationServiceInterface;
use TheCodingMachine\GraphQL\Controllers\Security\AuthorizationServiceInterface;
use TheCodingMachine\GraphQL\Controllers\Security\VoidAuthenticationService;
use TheCodingMachine\GraphQL\Controllers\Security\VoidAuthorizationService;
use TheCodingMachine\GraphQL\Controllers\TypeGenerator;
use TheCodingMachine\GraphQL\Controllers\Types\TypeResolver;
use TheCodingMachine\GraphQLite\Containers\BasicAutoWiringContainer;
use TheCodingMachine\GraphQLite\FieldsBuilderFactory;
use TheCodingMachine\GraphQLite\Hydrators\FactoryHydrator;
use TheCodingMachine\GraphQLite\Hydrators\HydratorInterface;
use TheCodingMachine\GraphQLite\InputTypeGenerator;
use TheCodingMachine\GraphQLite\InputTypeUtils;
use TheCodingMachine\GraphQLite\Mappers\GlobTypeMapper;
use TheCodingMachine\GraphQLite\Mappers\RecursiveTypeMapper;
use TheCodingMachine\GraphQLite\Mappers\RecursiveTypeMapperInterface;
use TheCodingMachine\GraphQLite\Mappers\TypeMapperInterface;
use TheCodingMachine\GraphQLite\NamingStrategy;
use TheCodingMachine\GraphQLite\Reflection\CachedDocBlockFactory;
use TheCodingMachine\GraphQLite\Security\AuthenticationServiceInterface;
use TheCodingMachine\GraphQLite\Security\AuthorizationServiceInterface;
use TheCodingMachine\GraphQLite\Security\VoidAuthenticationService;
use TheCodingMachine\GraphQLite\Security\VoidAuthorizationService;
use TheCodingMachine\GraphQLite\TypeGenerator;
use TheCodingMachine\GraphQLite\TypeRegistry;
use TheCodingMachine\GraphQLite\Types\TypeResolver;
use TheCodingMachine\TDBM\Configuration;
use TheCodingMachine\Tdbm\GraphQL\Registry\EmptyContainer;
use TheCodingMachine\Tdbm\GraphQL\Tests\Beans\Country;
Expand All @@ -43,16 +44,11 @@
use TheCodingMachine\Tdbm\GraphQL\Tests\GraphQL\CountryType;
use TheCodingMachine\Tdbm\GraphQL\Tests\GraphQL\Generated\AbstractCountryType;
use TheCodingMachine\Tdbm\GraphQL\Tests\GraphQL\Generated\AbstractUserType;
use TheCodingMachine\Tdbm\GraphQL\Tests\GraphQL\TdbmGraphQLTypeMapper;
use TheCodingMachine\Tdbm\GraphQL\Tests\GraphQL\UserType;
use TheCodingMachine\TDBM\TDBMService;
use TheCodingMachine\TDBM\Utils\DefaultNamingStrategy as TdbmDefaultNamingStrategy;
use PHPUnit\Framework\TestCase;
use Youshido\GraphQL\Execution\Context\ExecutionContext;
use Youshido\GraphQL\Execution\Processor;
use Youshido\GraphQL\Execution\ResolveInfo;
use GraphQL\Type\Schema;
use Youshido\GraphQL\Type\Scalar\StringType;

class GraphQLTypeGeneratorTest extends TestCase
{
Expand All @@ -71,7 +67,8 @@ public function setUp()
$container->get(AuthenticationServiceInterface::class),
$container->get(AuthorizationServiceInterface::class),
$container->get(TypeResolver::class),
$container->get(CachedDocBlockFactory::class)
$container->get(CachedDocBlockFactory::class),
$container->get(NamingStrategyInterface::class)
);
},
BasicAutoWiringContainer::class => function (ContainerInterface $container) {
Expand All @@ -84,7 +81,12 @@ public function setUp()
return new VoidAuthenticationService();
},
RecursiveTypeMapperInterface::class => function (ContainerInterface $container) {
return new RecursiveTypeMapper($container->get(TypeMapperInterface::class), $container->get(NamingStrategyInterface::class), new \Symfony\Component\Cache\Simple\ArrayCache());
return new RecursiveTypeMapper(
$container->get(TypeMapperInterface::class),
$container->get(NamingStrategyInterface::class),
new \Symfony\Component\Cache\Simple\ArrayCache(),
$container->get(TypeRegistry::class)
);
},
TypeMapperInterface::class => function (ContainerInterface $container) {
return new GlobTypeMapper(
Expand All @@ -102,9 +104,14 @@ public function setUp()
return new TypeGenerator(
$container->get(AnnotationReader::class),
$container->get(FieldsBuilderFactory::class),
$container->get(NamingStrategyInterface::class)
$container->get(NamingStrategyInterface::class),
$container->get(TypeRegistry::class),
$container->get(BasicAutoWiringContainer::class)
);
},
TypeRegistry::class => function () {
return new TypeRegistry();
},
AnnotationReader::class => function (ContainerInterface $container) {
return new AnnotationReader(new DoctrineAnnotationReader());
},
Expand Down Expand Up @@ -223,7 +230,7 @@ public function testQuery()
'name' => 'Query',
'fields' => [
'users' => [
'type' => Type::listOf($this->mainContainer->get(RecursiveTypeMapperInterface::class)->mapClassToType(User::class)),
'type' => Type::listOf($this->mainContainer->get(RecursiveTypeMapperInterface::class)->mapClassToType(User::class, null)),
'resolve' => function () use ($userDao) {
return $userDao->findAll();
}
Expand Down Expand Up @@ -319,7 +326,7 @@ private function recursiveDelete(string $str) : bool

public function testResultIteratorType()
{
$type = new ResultIteratorType($this->mainContainer->get(RecursiveTypeMapperInterface::class)->mapClassToType(Country::class));
$type = new ResultIteratorType($this->mainContainer->get(RecursiveTypeMapperInterface::class)->mapClassToType(Country::class, null));

$tdbmService = self::getTDBMService();
$countryDao = new CountryDao($tdbmService);
Expand Down

0 comments on commit 28beecf

Please sign in to comment.