function BrowserTestBaseTest::testTextAsserts
Tests legacy text asserts.
File
- 
              core/tests/ Drupal/ FunctionalTests/ BrowserTestBaseTest.php, line 298 
Class
- BrowserTestBaseTest
- Tests BrowserTestBase functionality.
Namespace
Drupal\FunctionalTestsCode
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);
}Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.
