You are here

public function EntityFieldValueTest::testBoolean in GraphQL 8.3

Test boolean fields.

File

modules/graphql_core/tests/src/Kernel/Entity/EntityFieldValueTest.php, line 48

Class

EntityFieldValueTest
Test basic entity fields.

Namespace

Drupal\Tests\graphql_core\Kernel\Entity

Code

public function testBoolean() {
  $this
    ->addField('boolean', "field_boolean", FALSE);
  $this
    ->mockNode([
    'field_boolean' => TRUE,
  ]);
  $this
    ->assertGraphQLFields([
    [
      'NodeTest',
      'fieldBoolean',
      'Boolean',
    ],
  ]);
  $query = <<<GQL
query {
  node {
    fieldBoolean
  }
}
GQL;
  $metadata = $this
    ->defaultCacheMetaData();
  $this
    ->assertResults($query, [], [
    'node' => [
      'fieldBoolean' => TRUE,
    ],
  ], $metadata);
}