@@ -2,18 +2,13 @@ |
||
| 2 | 2 | |
| 3 | 3 | namespace Youshido\Tests\Schema; |
| 4 | 4 | |
| 5 | -use Youshido\GraphQL\Config\Object\InterfaceTypeConfig; |
|
| 6 | -use Youshido\GraphQL\Config\Object\ObjectTypeConfig; |
|
| 7 | 5 | use Youshido\GraphQL\Execution\Processor; |
| 8 | 6 | use Youshido\GraphQL\Schema\Schema; |
| 9 | 7 | use Youshido\GraphQL\Type\InterfaceType\AbstractInterfaceType; |
| 10 | -use Youshido\GraphQL\Type\InterfaceType\InterfaceType; |
|
| 11 | 8 | use Youshido\GraphQL\Type\ListType\ListType; |
| 12 | -use Youshido\GraphQL\Type\NonNullType; |
|
| 13 | 9 | use Youshido\GraphQL\Type\Object\AbstractObjectType; |
| 14 | 10 | use Youshido\GraphQL\Type\Object\ObjectType; |
| 15 | 11 | use Youshido\GraphQL\Type\Scalar\IdType; |
| 16 | -use Youshido\GraphQL\Type\Scalar\IntType; |
|
| 17 | 12 | use Youshido\GraphQL\Type\Scalar\StringType; |
| 18 | 13 | |
| 19 | 14 | |
@@ -103,7 +103,7 @@ |
||
| 103 | 103 | 'fields' => [ |
| 104 | 104 | 'user' => [ |
| 105 | 105 | 'type' => new UserType(), |
| 106 | - 'resolve' => function ($args) { |
|
| 106 | + 'resolve' => function($args) { |
|
| 107 | 107 | return [ |
| 108 | 108 | 'id' => 'user-id-1', |
| 109 | 109 | 'fullName' => 'Alex', |
@@ -32,7 +32,7 @@ |
||
| 32 | 32 | 'args' => [ |
| 33 | 33 | 'sortOrder' => new StringType(), |
| 34 | 34 | ], |
| 35 | - 'resolve' => function ($args) { |
|
| 35 | + 'resolve' => function($args) { |
|
| 36 | 36 | return sprintf('Result with %s order', empty($args['sortOrder']) ? 'default' : $args['sortOrder']); |
| 37 | 37 | }, |
| 38 | 38 | ], |
@@ -48,13 +48,13 @@ discard block |
||
| 48 | 48 | 'fields' => [ |
| 49 | 49 | 'nonNullScalar' => [ |
| 50 | 50 | 'type' => new NonNullType(new IntType()), |
| 51 | - 'resolve' => function () { |
|
| 51 | + 'resolve' => function() { |
|
| 52 | 52 | return null; |
| 53 | 53 | }, |
| 54 | 54 | ], |
| 55 | 55 | 'nonNullList' => [ |
| 56 | 56 | 'type' => new NonNullType(new ListType(new IntType())), |
| 57 | - 'resolve' => function () { |
|
| 57 | + 'resolve' => function() { |
|
| 58 | 58 | return null; |
| 59 | 59 | } |
| 60 | 60 | ], |
@@ -66,7 +66,7 @@ discard block |
||
| 66 | 66 | 'name' => new StringType(), |
| 67 | 67 | ] |
| 68 | 68 | ])), |
| 69 | - 'resolve' => function () { |
|
| 69 | + 'resolve' => function() { |
|
| 70 | 70 | return [ |
| 71 | 71 | 'id' => new uid('6cfb044c-9c0a-4ddd-9ef8-a0b940818db3'), |
| 72 | 72 | 'name' => 'Alex' |
@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | ], |
| 76 | 76 | 'nonNullListOfNpnNull' => [ |
| 77 | 77 | 'type' => new NonNullType(new ListType(new NonNullType(new IntType()))), |
| 78 | - 'resolve' => function () { |
|
| 78 | + 'resolve' => function() { |
|
| 79 | 79 | return [1, null]; |
| 80 | 80 | } |
| 81 | 81 | ], |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | 'fields' => [ |
| 30 | 30 | 'currentTime' => [ |
| 31 | 31 | 'type' => new StringType(), |
| 32 | - 'resolve' => function ($value, $args, $type) { |
|
| 32 | + 'resolve' => function($value, $args, $type) { |
|
| 33 | 33 | return 'May 5, 9:00am'; |
| 34 | 34 | }, |
| 35 | 35 | 'args' => [ |
@@ -58,7 +58,7 @@ discard block |
||
| 58 | 58 | |
| 59 | 59 | $this->assertEquals(1, count($schema->getMutationType()->getFields())); |
| 60 | 60 | |
| 61 | - $schema->addMutationField('changeUser', ['type' => new TestObjectType(), 'resolve' => function () { }]); |
|
| 61 | + $schema->addMutationField('changeUser', ['type' => new TestObjectType(), 'resolve' => function() { }]); |
|
| 62 | 62 | $this->assertEquals(2, count($schema->getMutationType()->getFields())); |
| 63 | 63 | |
| 64 | 64 | } |
@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | 'fields' => [ |
| 90 | 90 | 'name' => new StringType(), |
| 91 | 91 | ], |
| 92 | - 'resolveType' => function () use ($authorType) { |
|
| 92 | + 'resolveType' => function() use ($authorType) { |
|
| 93 | 93 | return $authorType; |
| 94 | 94 | } |
| 95 | 95 | ]); |
@@ -102,13 +102,13 @@ discard block |
||
| 102 | 102 | 'interfaces' => [$userInterface] |
| 103 | 103 | ]); |
| 104 | 104 | |
| 105 | - $schema = new Schema([ |
|
| 105 | + $schema = new Schema([ |
|
| 106 | 106 | 'query' => new ObjectType([ |
| 107 | 107 | 'name' => 'QueryType', |
| 108 | 108 | 'fields' => [ |
| 109 | 109 | 'user' => [ |
| 110 | 110 | 'type' => $userInterface, |
| 111 | - 'resolve' => function () { |
|
| 111 | + 'resolve' => function() { |
|
| 112 | 112 | return [ |
| 113 | 113 | 'name' => 'Alex' |
| 114 | 114 | ]; |
@@ -135,13 +135,13 @@ discard block |
||
| 135 | 135 | $processor->processPayload('{ user { name { } } }'); |
| 136 | 136 | $result = $processor->getResponseData(); |
| 137 | 137 | |
| 138 | - $this->assertEquals(['errors' => [ ['message' => 'Unexpected token "RBRACE" at (1:19)']]], $result); |
|
| 138 | + $this->assertEquals(['errors' => [['message' => 'Unexpected token "RBRACE" at (1:19)']]], $result); |
|
| 139 | 139 | $processor->getExecutionContext()->clearErrors(); |
| 140 | 140 | |
| 141 | 141 | $processor->processPayload('{ user { name { invalidSelection } } }'); |
| 142 | 142 | $result = $processor->getResponseData(); |
| 143 | 143 | |
| 144 | - $this->assertEquals(['data' => ['user' => null], 'errors' => [ ['message' => 'You can\'t specify fields for scalar type "String"']]], $result); |
|
| 144 | + $this->assertEquals(['data' => ['user' => null], 'errors' => [['message' => 'You can\'t specify fields for scalar type "String"']]], $result); |
|
| 145 | 145 | } |
| 146 | 146 | |
| 147 | 147 | } |