From 937183405a612b82383b7621e23d646bbdf9968c Mon Sep 17 00:00:00 2001 From: Ankit Pathak Date: Thu, 18 Jul 2024 22:58:45 +0530 Subject: [PATCH] Attempt to fix the tests and adding both version for webonyx/graphql-php. --- composer.json | 2 +- src/Entity/Server.php | 7 ++++++- tests/src/Kernel/DataProducer/DefaultValueTest.php | 2 +- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/composer.json b/composer.json index 063f35601..18f84798d 100644 --- a/composer.json +++ b/composer.json @@ -7,7 +7,7 @@ "require": { "drupal/typed_data": "^1.0 || ^2.0", "php": ">=8.0", - "webonyx/graphql-php": "^15.12.0" + "webonyx/graphql-php": "^14.8.0 || ^15.12.0" }, "minimum-stability": "dev" } diff --git a/src/Entity/Server.php b/src/Entity/Server.php index 78511c4da..08859f1b4 100644 --- a/src/Entity/Server.php +++ b/src/Entity/Server.php @@ -247,7 +247,12 @@ public function configuration() { $server->setDebugFlag($this->get('debug_flag')); $server->setQueryBatching(!!$this->get('batching')); $server->setValidationRules($this->getValidationRules()); - $server->setPersistentQueryLoader($this->getPersistedQueryLoader()); + if (method_exists(ServerConfig::class, 'setPersistedQueryLoader')) { + $server->setPersistedQueryLoader($this->getPersistedQueryLoader()); + } + else { + $server->setPersistentQueryLoader($this->getPersistedQueryLoader()); + } $server->setContext($this->getContext($plugin, $params)); $server->setFieldResolver($this->getFieldResolver($registry)); $server->setSchema($plugin->getSchema($registry)); diff --git a/tests/src/Kernel/DataProducer/DefaultValueTest.php b/tests/src/Kernel/DataProducer/DefaultValueTest.php index 2185d2e7b..7e459e088 100644 --- a/tests/src/Kernel/DataProducer/DefaultValueTest.php +++ b/tests/src/Kernel/DataProducer/DefaultValueTest.php @@ -54,7 +54,7 @@ public function testLegacyDefaultValueSetting(bool $populate_setting, string $te /** * Data provider for the testLegacyDefaultValueSetting test. */ - public function settingsProvider(): array { + public static function settingsProvider(): array { return [ [FALSE, TestLegacyEntityLoad::class], [TRUE, TestNewEntityLoad::class],