View source
<?php
namespace Drupal\Tests\graphql\Kernel\Framework;
use Drupal\Core\DependencyInjection\ContainerBuilder;
use Drupal\Tests\graphql\Kernel\GraphQLTestBase;
class DisabledSchemaCacheTest extends GraphQLTestBase {
public function register(ContainerBuilder $container) {
parent::register($container);
$config = $container
->getParameter('graphql.config');
$container
->setParameter('graphql.config', [
'development' => TRUE,
] + $config);
}
public function testDisabledCacheWithoutCacheMetadata() {
$this
->mockField('foo', [
'id' => 'foo',
'name' => 'foo',
'type' => 'String',
], 'foo');
$this
->introspect();
$this
->mockField('bar', [
'id' => 'bar',
'name' => 'bar',
'type' => 'String',
], 'bar');
$schema = $this
->introspect();
$this
->assertArrayHasKey('bar', $schema['types']['Query']['fields'], 'Schema does not contain the new field.');
}
public function testDisabledCacheWithCacheMetadata() {
$this
->mockField('foo', [
'id' => 'foo',
'name' => 'foo',
'type' => 'String',
'schema_cache_tags' => [
'foo',
],
], 'foo');
$this
->introspect();
$this
->mockField('bar', [
'id' => 'bar',
'name' => 'bar',
'type' => 'String',
], 'bar');
$schema = $this
->introspect();
$this
->assertArrayHasKey('bar', $schema['types']['Query']['fields'], 'Schema does not contain the new field.');
}
}