public function EntityFieldValueTest::testFieldAssignment in GraphQL 8.3
Verify that fields are assigned correctly among bundles.
File
- modules/
graphql_core/ tests/ src/ Kernel/ Entity/ EntityFieldValueTest.php, line 170
Class
- EntityFieldValueTest
- Test basic entity fields.
Namespace
Drupal\Tests\graphql_core\Kernel\EntityCode
public function testFieldAssignment() {
$this
->createContentType([
'type' => 'a',
]);
$this
->createContentType([
'type' => 'b',
]);
$this
->addField('boolean', 'field_a', FALSE, 'A', 'a');
$this
->addField('boolean', 'field_b', FALSE, 'B', 'b');
// Verify that the fields for a given bundle are there.
$this
->assertGraphQLFields([
[
'NodeA',
'fieldA',
'Boolean',
],
[
'NodeB',
'fieldB',
'Boolean',
],
]);
// Verify that the fields of another bundle are *not* there.
$this
->assertGraphQLFields([
[
'NodeA',
'fieldB',
'Boolean',
],
[
'NodeB',
'fieldA',
'Boolean',
],
], TRUE);
}