Skip to content

Commit 52d81f8

Browse files
blazeyofubhy
authored andcommitted
Added test coverage for walking the entity graph vi reference fields. (#391)
1 parent 0ebc884 commit 52d81f8

2 files changed

Lines changed: 52 additions & 4 deletions

File tree

modules/graphql_core/tests/queries/raw_field_values.gql

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,12 @@ query ($path: String!) {
1010
type {
1111
targetId
1212
}
13+
uid {
14+
targetId
15+
entity {
16+
name
17+
}
18+
}
1319
title
1420
status
1521
promote
@@ -55,18 +61,33 @@ query ($path: String!) {
5561
}
5662
fieldReference {
5763
targetId
64+
entity {
65+
title
66+
fieldReference {
67+
targetId
68+
entity {
69+
title
70+
}
71+
}
72+
}
5873
}
5974
fieldFile {
6075
targetId
6176
display
6277
description
78+
entity {
79+
uri
80+
}
6381
}
6482
fieldImage {
6583
targetId
6684
alt
6785
title
6886
width
6987
height
88+
entity {
89+
uri
90+
}
7091
}
7192
}
7293
}

modules/graphql_core/tests/src/Kernel/Entity/EntityFieldValueTest.php

Lines changed: 31 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,6 @@ public function nodeValuesProvider() {
131131
'field_string' => ['test', '123'],
132132
'field_reference' => [
133133
['target_id' => 1],
134-
['target_id' => 1],
135134
],
136135
'field_file' => [
137136
[
@@ -172,6 +171,10 @@ public function nodeValuesProvider() {
172171
'type' => [
173172
'targetId' => 'test',
174173
],
174+
'uid' => [
175+
'targetId' => 0,
176+
'entity' => NULL,
177+
],
175178
'title' => 'Test',
176179
'status' => 1,
177180
'promote' => 1,
@@ -182,7 +185,7 @@ public function nodeValuesProvider() {
182185
'summary' => 'test summary',
183186
'summaryProcessed' => "<p>test summary</p>\n",
184187
'processed' => "<p>test</p>\n",
185-
'format' => null,
188+
'format' => NULL,
186189
],
187190
'fieldText' => [
188191
['value' => 'a'],
@@ -223,19 +226,37 @@ public function nodeValuesProvider() {
223226
'123',
224227
],
225228
'fieldReference' => [
226-
['targetId' => 1],
227-
['targetId' => 1],
229+
[
230+
'targetId' => 1,
231+
'entity' => [
232+
'title' => 'Test',
233+
'fieldReference' => [
234+
[
235+
'targetId' => 1,
236+
'entity' => [
237+
'title' => 'Test',
238+
],
239+
],
240+
],
241+
],
242+
],
228243
],
229244
'fieldFile' => [
230245
[
231246
'targetId' => 1,
232247
'display' => 0,
233248
'description' => 'description test 1',
249+
'entity' => [
250+
'uri' => 'public://example.txt'
251+
],
234252
],
235253
[
236254
'targetId' => 2,
237255
'display' => 1,
238256
'description' => 'description test 2',
257+
'entity' => [
258+
'uri' => 'public://example.png'
259+
],
239260
],
240261
],
241262
'fieldImage' => [
@@ -245,13 +266,19 @@ public function nodeValuesProvider() {
245266
'title' => 'title test 1',
246267
'width' => 100,
247268
'height' => 50,
269+
'entity' => [
270+
'uri' => 'public://example.txt'
271+
],
248272
],
249273
[
250274
'targetId' => 2,
251275
'alt' => 'alt test 2',
252276
'title' => 'title test 2',
253277
'width' => 200,
254278
'height' => 100,
279+
'entity' => [
280+
'uri' => 'public://example.png'
281+
],
255282
],
256283
],
257284
];

0 commit comments

Comments
 (0)