You are here

protected function BlockTest::setUp in GraphQL 8.3

Overrides GraphQLCoreTestBase::setUp

File

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

Class

BlockTest
Test block retrieval via GraphQL.

Namespace

Drupal\Tests\graphql_core\Kernel\Blocks

Code

protected function setUp() {
  parent::setUp();

  /** @var \Drupal\Core\Extension\ThemeInstallerInterface $themeInstaller */
  $themeInstaller = $this->container
    ->get('theme_installer');
  $themeInstaller
    ->install([
    'stark',
  ]);
  $this
    ->installEntitySchema('block_content');
  try {
    $this
      ->installEntitySchema('path_alias');
  } catch (PluginNotFoundException $exc) {

    // Ignore if the path_alias entity doesn't exist. This means we are
    // testing a Drupal version < 8.8 and aliases are not entities yet.
  }
  $this
    ->installConfig('block_content');
  $this
    ->installConfig('graphql_block_test');
  $this
    ->prophesize(BlockContent::class);
  $customBlock = BlockContent::create([
    'type' => 'basic',
    'info' => 'Custom block test',
    'body' => [
      'value' => '<p>This is a test block content.</p>',
      'format' => 'basic_html',
    ],
  ]);
  $customBlock
    ->save();
  $this
    ->placeBlock('block_content:' . $customBlock
    ->uuid(), [
    'region' => 'sidebar_first',
  ]);
}