You are here

public function EntityDefinitionTest::testEntityDefinition in GraphQL 8.4

Tests that retrieving an entity definition works.

File

tests/src/Kernel/DataProducer/EntityDefinitionTest.php, line 504

Class

EntityDefinitionTest
Test the entity_definition data producer and friends.

Namespace

Drupal\Tests\graphql\Kernel\DataProducer

Code

public function testEntityDefinition() : void {
  $query = <<<GQL
      query {
        entityDefinition(entity_type: "node", bundle: "article") {
          label
          fields {
            id
            label
            description
            type
            required
            multiple
            maxNumItems
            status
            defaultValue
            isReference
            isHidden
            weight
          }
        }
      }
GQL;
  $this->defaultCacheTags[] = 'config:field.field.node.article.field_test';
  $this
    ->assertResults($query, [], $this->fullDefinitionResult);
}