You are here

public function BrowserTestBaseTest::testTextAsserts in Drupal 10

Same name and namespace in other branches
  1. 8 core/tests/Drupal/FunctionalTests/BrowserTestBaseTest.php \Drupal\FunctionalTests\BrowserTestBaseTest::testTextAsserts()
  2. 9 core/tests/Drupal/FunctionalTests/BrowserTestBaseTest.php \Drupal\FunctionalTests\BrowserTestBaseTest::testTextAsserts()

Tests legacy text asserts.

File

core/tests/Drupal/FunctionalTests/BrowserTestBaseTest.php, line 263

Class

BrowserTestBaseTest
Tests BrowserTestBase functionality.

Namespace

Drupal\FunctionalTests

Code

public function testTextAsserts() {
  $this
    ->drupalGet('test-encoded');
  $dangerous = 'Bad html <script>alert(123);</script>';
  $sanitized = Html::escape($dangerous);
  $this
    ->assertSession()
    ->responseNotContains($dangerous);
  $this
    ->assertSession()
    ->responseContains($sanitized);
}