You are here

protected function IntrospectionTestTrait::introspect in GraphQL 8.3

Retrieve a name-index schema to easy assert type system plugins.

Return value

array The name-indexed schema.

6 calls to IntrospectionTestTrait::introspect()
DisabledSchemaCacheTest::testDisabledCacheWithCacheMetadata in tests/src/Kernel/Framework/DisabledSchemaCacheTest.php
Test disabled schema caching with cache metadata.
DisabledSchemaCacheTest::testDisabledCacheWithoutCacheMetadata in tests/src/Kernel/Framework/DisabledSchemaCacheTest.php
Test disabled schema caching without cache metadata.
IntrospectionTestTrait::assertGraphQLFields in tests/src/Traits/IntrospectionTestTrait.php
Assert certain fields in the GraphQL schema.
SchemaCacheTest::testCaching in tests/src/Kernel/Framework/SchemaCacheTest.php
Test basic schema caching.
SchemaCacheTest::testCachingWithInvalidation in tests/src/Kernel/Framework/SchemaCacheTest.php
Test tag based schema invalidation.

... See full list

File

tests/src/Traits/IntrospectionTestTrait.php, line 18

Class

IntrospectionTestTrait
Trait to retrieve a name-indexed schema to run assertions on it.

Namespace

Drupal\Tests\graphql\Traits

Code

protected function introspect() {
  if (method_exists($this, 'resetStaticCaches')) {
    $this
      ->resetStaticCaches();
  }
  $introspection = $this->container
    ->get('graphql.introspection')
    ->introspect($this
    ->getDefaultSchema());
  $this
    ->indexByName($introspection['data']);
  return $introspection['data']['__schema'];
}