You are here

public function DisabledResultCacheTest::testDisabledCache in GraphQL 8.3

Same name and namespace in other branches
  1. 8.4 tests/src/Kernel/Framework/DisabledResultCacheTest.php \Drupal\Tests\graphql\Kernel\Framework\DisabledResultCacheTest::testDisabledCache()

Test if disabling the result cache has the desired effect.

File

tests/src/Kernel/Framework/DisabledResultCacheTest.php, line 30

Class

DisabledResultCacheTest
Test disabled result cache.

Namespace

Drupal\Tests\graphql\Kernel\Framework

Code

public function testDisabledCache() {
  $this
    ->mockField('root', [
    'id' => 'root',
    'name' => 'root',
    'type' => 'String',
  ], NULL, function ($field) {
    $field
      ->expects(static::exactly(2))
      ->method('resolveValues')
      ->willReturnCallback(function () {
      (yield 'test');
    });
  });

  // The first request that is not supposed to be cached.
  $this
    ->query('{ root }');

  // This should invoke the processor a second time.
  $this
    ->query('{ root }');
}