You are here

public function BlockTest::testStaticBlocks in GraphQL 8.3

Test if two static blocks are in the content area.

File

modules/graphql_core/tests/src/Kernel/Blocks/BlockTest.php, line 74

Class

BlockTest
Test block retrieval via GraphQL.

Namespace

Drupal\Tests\graphql_core\Kernel\Blocks

Code

public function testStaticBlocks() {
  $query = $this
    ->getQueryFromFile('Blocks/blocks.gql');
  $metadata = $this
    ->defaultCacheMetaData();
  $metadata
    ->addCacheTags([
    'block_content:1',
    // TODO: Check metatags. Is the config metatag required?
    'config:block.block.stark_powered',
  ]);
  $this
    ->assertResults($query, [], [
    'route' => [
      'content' => [
        0 => [
          '__typename' => 'UnexposedEntity',
        ],
      ],
      'sidebar' => [
        0 => [
          '__typename' => 'BlockContentBasic',
          'body' => [
            'value' => '<p>This is a test block content.</p>',
          ],
        ],
      ],
    ],
  ], $metadata);
}