You are here

public function HtmlTitleTest::testEditNodePageTitle in HTML Title 8

Tests the edit node page title.

File

tests/src/Functional/HtmlTitleTest.php, line 160

Class

HtmlTitleTest
Tests the HTML Title module.

Namespace

Drupal\Tests\html_title\Functional

Code

public function testEditNodePageTitle() {
  $assert_session = $this
    ->assertSession();
  $this
    ->drupalGet(Url::fromRoute('entity.node.edit_form', [
    'node' => $this->node1
      ->id(),
  ]));
  $assert_session
    ->responseContains('<h1><em>Edit test</em> Test <sup>sup</sup>-tag</h1>');
  $this
    ->drupalGet(Url::fromRoute('entity.node.edit_form', [
    'node' => $this->node2
      ->id(),
  ]));
  $assert_session
    ->responseContains('<h1><em>Edit test</em> Test <sup>sup</sup>-tag, <sub>sub</sub>-tag and <br>br-tag</h1>');
  $this
    ->drupalGet(Url::fromRoute('entity.node.edit_form', [
    'node' => $this->node3
      ->id(),
  ]));
  $assert_session
    ->responseContains('<h1><em>Edit test</em> Test <sup>sup</sup>-tag, <sub>sub</sub>-tag, <br>br-tag and p-tag</h1>');
  $this
    ->drupalGet('fr/node/' . $this->node3
    ->id() . '/edit');
  $assert_session
    ->responseContains('<h1><em>Edit test</em> Test <sup>sup</sup>-tag, <sub>sub</sub>-tag, <br>br-tag and p-tag FR</h1>');
  $this
    ->drupalGet(Url::fromRoute('entity.node.edit_form', [
    'node' => $this->node4
      ->id(),
  ]));
  $assert_session
    ->responseContains('<h1><em>Edit test</em> Test p-tag</h1>');
}