From 8da3043702ddcfaa097d16b782da465a012be150 Mon Sep 17 00:00:00 2001 From: spawnia Date: Sun, 23 Jun 2019 21:26:38 +0200 Subject: [PATCH] Rename some test variable names --- docs/type-system/enum-types.md | 2 +- tests/Executor/DeferredFieldsTest.php | 4 ++-- tests/Executor/ExecutorSchemaTest.php | 2 +- tests/Executor/ExecutorTest.php | 2 +- tests/Executor/TestClasses/Adder.php | 2 +- tests/GraphQLTest.php | 2 +- tests/Type/EnumTypeTest.php | 12 ++++++------ tests/Type/IntrospectionTest.php | 2 +- tests/Type/QueryPlanTest.php | 2 +- 9 files changed, 15 insertions(+), 15 deletions(-) diff --git a/docs/type-system/enum-types.md b/docs/type-system/enum-types.md index 4cebdec..6170c0c 100644 --- a/docs/type-system/enum-types.md +++ b/docs/type-system/enum-types.md @@ -158,7 +158,7 @@ $heroType = new ObjectType([ 'args' => [ 'episode' => Type::nonNull($enumType) ], - 'resolve' => function($_value, $args) { + 'resolve' => function($root, $args) { return $args['episode'] === 5 ? true : false; } ] diff --git a/tests/Executor/DeferredFieldsTest.php b/tests/Executor/DeferredFieldsTest.php index e68388c..a4021d2 100644 --- a/tests/Executor/DeferredFieldsTest.php +++ b/tests/Executor/DeferredFieldsTest.php @@ -109,10 +109,10 @@ class DeferredFieldsTest extends TestCase 'fields' => [ 'title' => [ 'type' => Type::string(), - 'resolve' => function ($entry, $args, $context, ResolveInfo $info) { + 'resolve' => function ($story, $args, $context, ResolveInfo $info) { $this->paths[] = $info->path; - return $entry['title']; + return $story['title']; }, ], 'author' => [ diff --git a/tests/Executor/ExecutorSchemaTest.php b/tests/Executor/ExecutorSchemaTest.php index 4946c59..2a0fd99 100644 --- a/tests/Executor/ExecutorSchemaTest.php +++ b/tests/Executor/ExecutorSchemaTest.php @@ -75,7 +75,7 @@ class ExecutorSchemaTest extends TestCase 'article' => [ 'type' => $BlogArticle, 'args' => ['id' => ['type' => Type::id()]], - 'resolve' => function ($_, $args) { + 'resolve' => function ($root, $args) { return $this->article($args['id']); }, ], diff --git a/tests/Executor/ExecutorTest.php b/tests/Executor/ExecutorTest.php index 9f5480f..7e7082b 100644 --- a/tests/Executor/ExecutorTest.php +++ b/tests/Executor/ExecutorTest.php @@ -273,7 +273,7 @@ class ExecutorTest extends TestCase 'fields' => [ 'test' => [ 'type' => Type::string(), - 'resolve' => static function ($val, $args, $ctx, $_info) use (&$info) { + 'resolve' => static function ($root, $args, $ctx, $_info) use (&$info) { $info = $_info; }, ], diff --git a/tests/Executor/TestClasses/Adder.php b/tests/Executor/TestClasses/Adder.php index b086b51..804617b 100644 --- a/tests/Executor/TestClasses/Adder.php +++ b/tests/Executor/TestClasses/Adder.php @@ -16,7 +16,7 @@ class Adder { $this->num = $num; - $this->test = function ($source, $args, $context) { + $this->test = function ($root, $args, $context) { return $this->num + $args['addend1'] + $context['addend2']; }; } diff --git a/tests/GraphQLTest.php b/tests/GraphQLTest.php index 13193b5..15da589 100644 --- a/tests/GraphQLTest.php +++ b/tests/GraphQLTest.php @@ -30,7 +30,7 @@ class GraphQLTest extends TestCase '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'])); }, ], diff --git a/tests/Type/EnumTypeTest.php b/tests/Type/EnumTypeTest.php index 9b2e8e6..8e579de 100644 --- a/tests/Type/EnumTypeTest.php +++ b/tests/Type/EnumTypeTest.php @@ -74,7 +74,7 @@ class EnumTypeTest extends TestCase 'fromInt' => ['type' => Type::int()], 'fromString' => ['type' => Type::string()], ], - 'resolve' => static function ($value, $args) { + 'resolve' => static function ($root, $args) { if (isset($args['fromInt'])) { return $args['fromInt']; } @@ -92,7 +92,7 @@ class EnumTypeTest extends TestCase 'fromName' => ['type' => Type::string()], 'fromValue' => ['type' => Type::string()], ], - 'resolve' => static function ($value, $args) { + 'resolve' => static function ($root, $args) { if (isset($args['fromName'])) { return $args['fromName']; } @@ -107,7 +107,7 @@ class EnumTypeTest extends TestCase 'fromEnum' => ['type' => $ColorType], 'fromInt' => ['type' => Type::int()], ], - 'resolve' => static function ($value, $args) { + 'resolve' => static function ($root, $args) { if (isset($args['fromInt'])) { return $args['fromInt']; } @@ -132,7 +132,7 @@ class EnumTypeTest extends TestCase 'type' => Type::boolean(), ], ], - 'resolve' => static function ($value, $args) use ($Complex2) { + 'resolve' => static function ($root, $args) use ($Complex2) { if (! empty($args['provideGoodValue'])) { // Note: this is one of the references of the internal values which // ComplexEnum allows. @@ -156,7 +156,7 @@ class EnumTypeTest extends TestCase 'favoriteEnum' => [ 'type' => $ColorType, 'args' => ['color' => ['type' => $ColorType]], - 'resolve' => static function ($value, $args) { + 'resolve' => static function ($root, $args) { return $args['color'] ?? null; }, ], @@ -169,7 +169,7 @@ class EnumTypeTest extends TestCase 'subscribeToEnum' => [ 'type' => $ColorType, 'args' => ['color' => ['type' => $ColorType]], - 'resolve' => static function ($value, $args) { + 'resolve' => static function ($root, $args) { return $args['color'] ?? null; }, ], diff --git a/tests/Type/IntrospectionTest.php b/tests/Type/IntrospectionTest.php index 51feb40..d92bba0 100644 --- a/tests/Type/IntrospectionTest.php +++ b/tests/Type/IntrospectionTest.php @@ -1049,7 +1049,7 @@ class IntrospectionTest extends TestCase 'field' => [ 'type' => Type::string(), 'args' => ['complex' => ['type' => $TestInputObject]], - 'resolve' => static function ($_, $args) { + 'resolve' => static function ($root, $args) { return json_encode($args['complex']); }, ], diff --git a/tests/Type/QueryPlanTest.php b/tests/Type/QueryPlanTest.php index 73f8ae7..a0d05fd 100644 --- a/tests/Type/QueryPlanTest.php +++ b/tests/Type/QueryPlanTest.php @@ -393,7 +393,7 @@ final class QueryPlanTest extends TestCase } }, ]); - $result = GraphQL::executeQuery($schema, $query)->toArray(); + GraphQL::executeQuery($schema, $query)->toArray(); self::assertTrue($hasCalled); self::assertEquals($expectedQueryPlan, $queryPlan->queryPlan());