You are here

protected function BlockFormAlterTest::setUp in Block Form Alter 8

Overrides BrowserTestBase::setUp

File

tests/src/Functional/BlockFormAlterTest.php, line 35

Class

BlockFormAlterTest
Tests functionality of block_form_alter module.

Namespace

Drupal\Tests\block_form_alter\Functional

Code

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

  // Place certain blocks.
  $this
    ->drupalPlaceBlock('system_menu_block:account');
  $this
    ->drupalPlaceBlock('local_tasks_block');
  $this
    ->drupalPlaceBlock('system_branding_block', [
    'label' => 'Branding Block',
    'id' => 'systembrandingblock',
  ]);

  // Create a custom block type.
  $bundle = BlockContentType::create([
    'id' => 'test_block',
    'label' => 'Test Block',
    'revision' => FALSE,
  ]);
  $bundle
    ->save();
  block_content_add_body_field('test_block');

  // Create a content type and node.
  $this
    ->createContentType([
    'type' => 'bundle_with_section_field',
    'name' => 'Bundle with section field',
  ]);
  $this
    ->createNode([
    'type' => 'bundle_with_section_field',
    'title' => 'The first node title',
    'body' => [
      [
        'value' => 'The first node body',
      ],
    ],
  ]);

  // Create admin user.
  $this->adminUser = $this
    ->drupalCreateUser([
    'access administration pages',
    'administer blocks',
    'bypass node access',
    'administer node display',
    'access contextual links',
  ]);
}