Rename some test variable names

This commit is contained in:
spawnia 2019-06-23 21:26:38 +02:00
parent 65a3a8d13e
commit 8da3043702
9 changed files with 15 additions and 15 deletions

View File

@ -158,7 +158,7 @@ $heroType = new ObjectType([
'args' => [ 'args' => [
'episode' => Type::nonNull($enumType) 'episode' => Type::nonNull($enumType)
], ],
'resolve' => function($_value, $args) { 'resolve' => function($root, $args) {
return $args['episode'] === 5 ? true : false; return $args['episode'] === 5 ? true : false;
} }
] ]

View File

@ -109,10 +109,10 @@ class DeferredFieldsTest extends TestCase
'fields' => [ 'fields' => [
'title' => [ 'title' => [
'type' => Type::string(), 'type' => Type::string(),
'resolve' => function ($entry, $args, $context, ResolveInfo $info) { 'resolve' => function ($story, $args, $context, ResolveInfo $info) {
$this->paths[] = $info->path; $this->paths[] = $info->path;
return $entry['title']; return $story['title'];
}, },
], ],
'author' => [ 'author' => [

View File

@ -75,7 +75,7 @@ class ExecutorSchemaTest extends TestCase
'article' => [ 'article' => [
'type' => $BlogArticle, 'type' => $BlogArticle,
'args' => ['id' => ['type' => Type::id()]], 'args' => ['id' => ['type' => Type::id()]],
'resolve' => function ($_, $args) { 'resolve' => function ($root, $args) {
return $this->article($args['id']); return $this->article($args['id']);
}, },
], ],

View File

@ -273,7 +273,7 @@ class ExecutorTest extends TestCase
'fields' => [ 'fields' => [
'test' => [ 'test' => [
'type' => Type::string(), 'type' => Type::string(),
'resolve' => static function ($val, $args, $ctx, $_info) use (&$info) { 'resolve' => static function ($root, $args, $ctx, $_info) use (&$info) {
$info = $_info; $info = $_info;
}, },
], ],

View File

@ -16,7 +16,7 @@ class Adder
{ {
$this->num = $num; $this->num = $num;
$this->test = function ($source, $args, $context) { $this->test = function ($root, $args, $context) {
return $this->num + $args['addend1'] + $context['addend2']; return $this->num + $args['addend1'] + $context['addend2'];
}; };
} }

View File

@ -30,7 +30,7 @@ class GraphQLTest extends TestCase
'type' => Type::nonNull(Type::string()), 'type' => Type::nonNull(Type::string()),
], ],
], ],
'resolve' => static function ($value, $args) use ($promiseAdapter) { 'resolve' => static function ($root, $args) use ($promiseAdapter) {
return $promiseAdapter->createFulfilled(sprintf('Hi %s!', $args['name'])); return $promiseAdapter->createFulfilled(sprintf('Hi %s!', $args['name']));
}, },
], ],

View File

@ -74,7 +74,7 @@ class EnumTypeTest extends TestCase
'fromInt' => ['type' => Type::int()], 'fromInt' => ['type' => Type::int()],
'fromString' => ['type' => Type::string()], 'fromString' => ['type' => Type::string()],
], ],
'resolve' => static function ($value, $args) { 'resolve' => static function ($root, $args) {
if (isset($args['fromInt'])) { if (isset($args['fromInt'])) {
return $args['fromInt']; return $args['fromInt'];
} }
@ -92,7 +92,7 @@ class EnumTypeTest extends TestCase
'fromName' => ['type' => Type::string()], 'fromName' => ['type' => Type::string()],
'fromValue' => ['type' => Type::string()], 'fromValue' => ['type' => Type::string()],
], ],
'resolve' => static function ($value, $args) { 'resolve' => static function ($root, $args) {
if (isset($args['fromName'])) { if (isset($args['fromName'])) {
return $args['fromName']; return $args['fromName'];
} }
@ -107,7 +107,7 @@ class EnumTypeTest extends TestCase
'fromEnum' => ['type' => $ColorType], 'fromEnum' => ['type' => $ColorType],
'fromInt' => ['type' => Type::int()], 'fromInt' => ['type' => Type::int()],
], ],
'resolve' => static function ($value, $args) { 'resolve' => static function ($root, $args) {
if (isset($args['fromInt'])) { if (isset($args['fromInt'])) {
return $args['fromInt']; return $args['fromInt'];
} }
@ -132,7 +132,7 @@ class EnumTypeTest extends TestCase
'type' => Type::boolean(), 'type' => Type::boolean(),
], ],
], ],
'resolve' => static function ($value, $args) use ($Complex2) { 'resolve' => static function ($root, $args) use ($Complex2) {
if (! empty($args['provideGoodValue'])) { if (! empty($args['provideGoodValue'])) {
// Note: this is one of the references of the internal values which // Note: this is one of the references of the internal values which
// ComplexEnum allows. // ComplexEnum allows.
@ -156,7 +156,7 @@ class EnumTypeTest extends TestCase
'favoriteEnum' => [ 'favoriteEnum' => [
'type' => $ColorType, 'type' => $ColorType,
'args' => ['color' => ['type' => $ColorType]], 'args' => ['color' => ['type' => $ColorType]],
'resolve' => static function ($value, $args) { 'resolve' => static function ($root, $args) {
return $args['color'] ?? null; return $args['color'] ?? null;
}, },
], ],
@ -169,7 +169,7 @@ class EnumTypeTest extends TestCase
'subscribeToEnum' => [ 'subscribeToEnum' => [
'type' => $ColorType, 'type' => $ColorType,
'args' => ['color' => ['type' => $ColorType]], 'args' => ['color' => ['type' => $ColorType]],
'resolve' => static function ($value, $args) { 'resolve' => static function ($root, $args) {
return $args['color'] ?? null; return $args['color'] ?? null;
}, },
], ],

View File

@ -1049,7 +1049,7 @@ class IntrospectionTest extends TestCase
'field' => [ 'field' => [
'type' => Type::string(), 'type' => Type::string(),
'args' => ['complex' => ['type' => $TestInputObject]], 'args' => ['complex' => ['type' => $TestInputObject]],
'resolve' => static function ($_, $args) { 'resolve' => static function ($root, $args) {
return json_encode($args['complex']); return json_encode($args['complex']);
}, },
], ],

View File

@ -393,7 +393,7 @@ final class QueryPlanTest extends TestCase
} }
}, },
]); ]);
$result = GraphQL::executeQuery($schema, $query)->toArray(); GraphQL::executeQuery($schema, $query)->toArray();
self::assertTrue($hasCalled); self::assertTrue($hasCalled);
self::assertEquals($expectedQueryPlan, $queryPlan->queryPlan()); self::assertEquals($expectedQueryPlan, $queryPlan->queryPlan());