You are here

protected function SmartTitleConfigTest::setUp in Smart Title 8

Overrides SmartTitleBrowserTestBase::setUp

File

tests/src/Functional/SmartTitleConfigTest.php, line 17

Class

SmartTitleConfigTest
Tests the module's title hide functionality.

Namespace

Drupal\Tests\smart_title\Functional

Code

protected function setUp() {
  parent::setUp();
  $this
    ->drupalLogin($this->adminUser);

  // Enable Smart Title for the test_page content type's teaser.
  $this
    ->drupalLogin($this->adminUser);
  $this
    ->drupalPostForm('admin/structure/types/manage/test_page/display/teaser', [
    'smart_title__enabled' => TRUE,
  ], 'Save');
  $this
    ->drupalPostForm(NULL, [
    'fields[smart_title][weight]' => '-5',
    'fields[smart_title][region]' => 'content',
  ], 'Save');
  $teaser_display = $this->container
    ->get('entity_type.manager')
    ->getStorage('entity_view_display')
    ->load('node.' . $this->testPageNode
    ->getType() . '.teaser');
  assert($teaser_display instanceof EntityViewDisplayInterface);
  $smart_title_enabled = $teaser_display
    ->getThirdPartySetting('smart_title', 'enabled', FALSE);
  $this
    ->assertTrue($smart_title_enabled);
}