You are here

public function HtmlTitleTest::testSearchPage in HTML Title 8

Tests the search module in combination with HTML title.

File

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

Class

HtmlTitleTest
Tests the HTML Title module.

Namespace

Drupal\Tests\html_title\Functional

Code

public function testSearchPage() {
  $assert_session = $this
    ->assertSession();
  $this
    ->drupalGet('search/node');
  $this
    ->submitForm([
    'keys' => 'test br-tag p-tag',
    'language[en]' => 'en',
  ], 'Search');
  $element = $assert_session
    ->elementExists('css', 'ol li:first-child h3 a');
  $this
    ->assertEquals('Test <sup>sup</sup>-tag, <sub>sub</sub>-tag, <br>br-tag and p-tag', trim($element
    ->getHtml()));
  $this
    ->drupalGet('fr/search/node');
  $this
    ->submitForm([
    'keys' => 'test br-tag p-tag',
    'language[fr]' => 'fr',
  ], 'Search');
  $element = $assert_session
    ->elementExists('css', 'ol li:first-child h3 a');
  $this
    ->assertEquals('Test <sup>sup</sup>-tag, <sub>sub</sub>-tag, <br>br-tag and p-tag FR', trim($element
    ->getHtml()));
}