From 9a112403af11c396d5f7db6f71728fc3782147bc Mon Sep 17 00:00:00 2001 From: Steve Boyd Date: Wed, 13 Apr 2022 11:35:13 +1200 Subject: [PATCH] MNT Compatibility with webonyx/graphql-php v14 --- .../GraphQL/DuplicateElementMutationTest.php | 4 ++-- tests/GraphQL/FakeResolveInfo.php | 21 ++++++++++++++++++- .../Legacy/AddElementToAreaMutationTest.php | 4 ++-- .../Legacy/SortBlockMutationCreatorTest.php | 4 ++-- 4 files changed, 26 insertions(+), 7 deletions(-) diff --git a/tests/GraphQL/DuplicateElementMutationTest.php b/tests/GraphQL/DuplicateElementMutationTest.php index 38368e7f..66a94b2d 100644 --- a/tests/GraphQL/DuplicateElementMutationTest.php +++ b/tests/GraphQL/DuplicateElementMutationTest.php @@ -5,7 +5,7 @@ use DNADesign\Elemental\GraphQL\DuplicateElementMutation; use DNADesign\Elemental\Models\BaseElement; use DNADesign\Elemental\Models\ElementalArea; -use GraphQL\Type\Definition\ResolveInfo; +use DNADesign\Elemental\Tests\GraphQL\FakeResolveInfo; use InvalidArgumentException; use SilverStripe\Dev\SapphireTest; use SilverStripe\Security\Security; @@ -62,7 +62,7 @@ public function canCreate($member = null, $context = []) $object = null; $args = ['id' => $element->ID]; $context = ['currentUser' => Security::getCurrentUser()]; - $resolveInfo = new ResolveInfo([]); + $resolveInfo = new FakeResolveInfo(); $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessageRegExp("#insufficient permission to {$operation}#"); diff --git a/tests/GraphQL/FakeResolveInfo.php b/tests/GraphQL/FakeResolveInfo.php index 524f4db3..bc6c9c61 100644 --- a/tests/GraphQL/FakeResolveInfo.php +++ b/tests/GraphQL/FakeResolveInfo.php @@ -1,13 +1,32 @@ 'fake', 'type' => Type::string()]), + [], + new ObjectType(['name' => 'fake']), + [], + new Schema([]), + [], + '', + null, + [] + ); } } diff --git a/tests/GraphQL/Legacy/AddElementToAreaMutationTest.php b/tests/GraphQL/Legacy/AddElementToAreaMutationTest.php index fe83dbb6..e3e23cc1 100644 --- a/tests/GraphQL/Legacy/AddElementToAreaMutationTest.php +++ b/tests/GraphQL/Legacy/AddElementToAreaMutationTest.php @@ -4,8 +4,8 @@ use DNADesign\Elemental\GraphQL\AddElementToAreaMutation; use DNADesign\Elemental\Models\ElementalArea; +use DNADesign\Elemental\Tests\GraphQL\FakeResolveInfo; use DNADesign\Elemental\Tests\Src\TestElement; -use GraphQL\Type\Definition\ResolveInfo; use InvalidArgumentException; use SilverStripe\Dev\SapphireTest; use SilverStripe\GraphQL\Schema\Schema; @@ -81,7 +81,7 @@ protected function runMutation($className, $elementalAreaID, $afterElementId = n { $mutation = new AddElementToAreaMutation(); $context = ['currentUser' => Security::getCurrentUser()]; - $resolveInfo = new ResolveInfo([]); + $resolveInfo = new FakeResolveInfo(); $args = [ 'className' => $className, diff --git a/tests/GraphQL/Legacy/SortBlockMutationCreatorTest.php b/tests/GraphQL/Legacy/SortBlockMutationCreatorTest.php index fb8a7b03..b89478b8 100644 --- a/tests/GraphQL/Legacy/SortBlockMutationCreatorTest.php +++ b/tests/GraphQL/Legacy/SortBlockMutationCreatorTest.php @@ -3,8 +3,8 @@ namespace DNADesign\Elemental\Tests\Legacy\GraphQL; use DNADesign\Elemental\GraphQL\SortBlockMutationCreator; +use DNADesign\Elemental\Tests\GraphQL\FakeResolveInfo; use DNADesign\Elemental\Tests\Src\TestElement; -use GraphQL\Type\Definition\ResolveInfo; use SilverStripe\Dev\SapphireTest; use SilverStripe\GraphQL\Schema\Schema; use SilverStripe\Security\Security; @@ -56,7 +56,7 @@ protected function runMutation($id, $afterBlockId) $mutation = new SortBlockMutationCreator(); $context = ['currentUser' => $member]; - $resolveInfo = new ResolveInfo([]); + $resolveInfo = new FakeResolveInfo(); $mutation->resolve(null, [ 'id' => $id,