From a4642a43694f1e6df9b45f785e678b568715ce54 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. --- .github/workflows/testing.yml | 2 +- composer.json | 2 +- src/Entity/Server.php | 7 ++++++- tests/src/Kernel/DataProducer/DefaultValueTest.php | 2 +- 4 files changed, 9 insertions(+), 4 deletions(-) diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml index 10cf6236f..c4581244a 100644 --- a/.github/workflows/testing.yml +++ b/.github/workflows/testing.yml @@ -93,7 +93,7 @@ jobs: - name: Install GraphQL dependencies run: | composer --no-interaction --no-progress require \ - webonyx/graphql-php:^15.12 \ + webonyx/graphql-php:^14.8 \ drupal/typed_data:^2.0 \ drupal/redirect:dev-1.x diff --git a/composer.json b/composer.json index 063f35601..b1527772d 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" }, "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],