You are here

public function DisabledSchemaCacheTest::testDisabledCacheWithCacheMetadata in GraphQL 8.3

Test disabled schema caching with cache metadata.

File

tests/src/Kernel/Framework/DisabledSchemaCacheTest.php, line 57

Class

DisabledSchemaCacheTest
Test schema caching.

Namespace

Drupal\Tests\graphql\Kernel\Framework

Code

public function testDisabledCacheWithCacheMetadata() {

  // Create a first field.
  $this
    ->mockField('foo', [
    'id' => 'foo',
    'name' => 'foo',
    'type' => 'String',
    'schema_cache_tags' => [
      'foo',
    ],
  ], 'foo');

  // Run introspect to populate the schema cache.
  $this
    ->introspect();

  // Add another field.
  $this
    ->mockField('bar', [
    'id' => 'bar',
    'name' => 'bar',
    'type' => 'String',
  ], 'bar');

  // Run introspect again, the new field should appear immediately.
  $schema = $this
    ->introspect();
  $this
    ->assertArrayHasKey('bar', $schema['types']['Query']['fields'], 'Schema does not contain the new field.');
}