function EntityFilteringThemeTest::testThemedEntity

Checks each themed entity for XSS filtering in available themes.

File

drupal/core/modules/system/lib/Drupal/system/Tests/Theme/EntityFilteringThemeTest.php, line 122
Contains Drupal\system\Tests\Theme\EntityFilteringThemeTest.

Class

EntityFilteringThemeTest
Tests filtering for XSS in rendered entity templates in all themes.

Namespace

Drupal\system\Tests\Theme

Code

function testThemedEntity() {

  // Check paths where various view modes of the entities are rendered.
  $paths = array(
    'user',
    'node',
    'node/' . $this->node->nid,
    'taxonomy/term/' . $this->term->tid,
  );

  // Check each path in all available themes.
  foreach ($this->themes as $theme) {
    variable_set('theme_default', $theme);
    foreach ($paths as $path) {
      $this
        ->drupalGet($path);
      $this
        ->assertResponse(200);
      $this
        ->assertNoRaw($this->xss_label);
    }
  }
}