You are here

public function InlineBlockTitleAutomaticTest::testAutomaticTitle in Inline Block Title Automatic 8

Test the automatic title.

File

tests/src/Functional/InlineBlockTitleAutomaticTest.php, line 97

Class

InlineBlockTitleAutomaticTest
Test the inline block automatic module.

Namespace

Drupal\Tests\inline_block_title_automatic\Functional

Code

public function testAutomaticTitle() {

  // Before the module is installed, the title fields should be visible on
  // reusable and inline block content entities.
  $this
    ->drupalGet("layout_builder/add/block/overrides/node.{$this->node->id()}/0/content/inline_block:rich_text");
  $this
    ->assertTitleFieldsExist();
  $this
    ->drupalGet("layout_builder/add/block/overrides/node.{$this->node->id()}/0/content/block_content:{$this->reusableBlock->uuid()}");
  $this
    ->assertTitleFieldsExist();

  // Non block_content entity blocks should be unaffected.
  $this
    ->drupalGet("layout_builder/add/block/overrides/node.{$this->node->id()}/0/content/user_login_block");
  $this
    ->assertTitleFieldsExist();

  // After installing the module, the title fields should be hidden.
  $this->container
    ->get('module_installer')
    ->install([
    'inline_block_title_automatic',
  ]);
  $this
    ->drupalGet("layout_builder/add/block/overrides/node.{$this->node->id()}/0/content/inline_block:rich_text");
  $this
    ->assertTitleFieldsNotExist();
  $this
    ->drupalGet("layout_builder/add/block/overrides/node.{$this->node->id()}/0/content/block_content:{$this->reusableBlock->uuid()}");
  $this
    ->assertTitleFieldsNotExist();

  // However the non block_content block should be unaffected.
  $this
    ->drupalGet("layout_builder/add/block/overrides/node.{$this->node->id()}/0/content/user_login_block");
  $this
    ->assertTitleFieldsExist();
}