You are here

public function FunctionalFixedBlockTestBase::setUp in Fixed Block Content 8

Overrides BrowserTestBase::setUp

1 call to FunctionalFixedBlockTestBase::setUp()
FixedBlockAdminTest::setUp in tests/src/Functional/FixedBlockAdminTest.php
1 method overrides FunctionalFixedBlockTestBase::setUp()
FixedBlockAdminTest::setUp in tests/src/Functional/FixedBlockAdminTest.php

File

tests/src/Functional/FunctionalFixedBlockTestBase.php, line 41

Class

FunctionalFixedBlockTestBase
Base class for functional tests for the fixed block content.

Namespace

Drupal\Tests\fixed_block_content\Functional

Code

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

  // Create a content block type.
  $entity_type_manager = $this->container
    ->get('entity_type.manager');
  $type = $entity_type_manager
    ->getStorage('block_content_type')
    ->create([
    'id' => 'basic',
    'label' => 'Basic',
    'revision' => FALSE,
  ]);
  $type
    ->save();

  // Add body field.
  block_content_add_body_field($type
    ->id());

  // Create a fixed content block.
  $this->fixedBlock = $entity_type_manager
    ->getStorage('fixed_block_content')
    ->create([
    'id' => 'basic_fixed',
    'title' => 'Basic fixed',
    'block_content_bundle' => 'basic',
  ]);
  $this->fixedBlock
    ->save();

  // Place the fixed block.
  $this
    ->drupalPlaceBlock('fixed_block_content:basic_fixed');
}