You are here

public function EntityDefinitionTest::testBaseFieldFilter in GraphQL 8.4

Tests that filtering base field definitions works.

File

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

Class

EntityDefinitionTest
Test the entity_definition data producer and friends.

Namespace

Drupal\Tests\graphql\Kernel\DataProducer

Code

public function testBaseFieldFilter() : void {
  $query = <<<GQL
      query {
        entityDefinition(entity_type: "node", bundle: "article", field_types: BASE_FIELDS) {
          label
          fields {
            id
            label
            description
            type
            required
            multiple
            maxNumItems
            status
            defaultValue
            isReference
            isHidden
            weight
          }
        }
      }
GQL;
  $expectedResult = $this->fullDefinitionResult;

  // Remove the one configured field that should not be in the list of base
  // fields.
  unset($expectedResult['entityDefinition']['fields'][18]);
  $this
    ->assertResults($query, [], $expectedResult);
}