From 844b63994f5bfb8a440d67b4d65716e2f396c984 Mon Sep 17 00:00:00 2001 From: Daniel Bosen Date: Tue, 21 Nov 2023 09:17:46 +0100 Subject: [PATCH] Tests only --- .../SchemaExtension/ThunderSchemaExtensionPluginBase.php | 9 ++------- modules/thunder_gqls/tests/src/Functional/SchemaTest.php | 8 ++++++-- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/modules/thunder_gqls/src/Plugin/GraphQL/SchemaExtension/ThunderSchemaExtensionPluginBase.php b/modules/thunder_gqls/src/Plugin/GraphQL/SchemaExtension/ThunderSchemaExtensionPluginBase.php index d5fe25b9e..4f2bfb756 100644 --- a/modules/thunder_gqls/src/Plugin/GraphQL/SchemaExtension/ThunderSchemaExtensionPluginBase.php +++ b/modules/thunder_gqls/src/Plugin/GraphQL/SchemaExtension/ThunderSchemaExtensionPluginBase.php @@ -104,13 +104,8 @@ protected function resolveBaseFields(string $type, string $entity_type_id): void $this->addFieldResolverIfNotExists( $type, 'name', - $this->builder->compose( - $this->builder->produce('entity_label') - ->map('entity', $this->builder->fromParent()), - $this->builder->callback(function ($parent) { - return $parent ?: ''; - }) - ) + $this->builder->produce('entity_label') + ->map('entity', $this->builder->fromParent()) ); $this->addFieldResolverIfNotExists($type, 'language', diff --git a/modules/thunder_gqls/tests/src/Functional/SchemaTest.php b/modules/thunder_gqls/tests/src/Functional/SchemaTest.php index 9a8fa2153..34df42468 100644 --- a/modules/thunder_gqls/tests/src/Functional/SchemaTest.php +++ b/modules/thunder_gqls/tests/src/Functional/SchemaTest.php @@ -181,8 +181,12 @@ public function testLabelAccess(): void { $this->assertEquals(200, $response->getStatusCode(), 'Response not 200'); $page = $this->jsonDecode($response->getBody()); - file_put_contents('test-output.txt', print_r($page, TRUE)); - + $this->assertArrayNotHasKey('errors', $page); + $this->assertArrayHasKey('data', $page); + $this->assertArrayHasKey('page', $page['data']); + $this->assertArrayHasKey('channel', $page['data']['page']); + $this->assertArrayHasKey('name', $page['data']['page']['channel']); + $this->assertEmpty($page['data']['page']['channel']['name']); } }