You are here

function EntityFilteringThemeTest::testThemedEntity in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/system/src/Tests/Theme/EntityFilteringThemeTest.php \Drupal\system\Tests\Theme\EntityFilteringThemeTest::testThemedEntity()

Checks each themed entity for XSS filtering in available themes.

File

core/modules/system/src/Tests/Theme/EntityFilteringThemeTest.php, line 127
Contains \Drupal\system\Tests\Theme\EntityFilteringThemeTest.

Class

EntityFilteringThemeTest
Tests themed output for each entity type in all available themes to ensure entity labels are filtered for XSS.

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
      ->id(),
    'taxonomy/term/' . $this->term
      ->id(),
  );

  // Check each path in all available themes.
  foreach ($this->themes as $name => $theme) {
    $this
      ->config('system.theme')
      ->set('default', $name)
      ->save();
    foreach ($paths as $path) {
      $this
        ->drupalGet($path);
      $this
        ->assertResponse(200);
      $this
        ->assertNoRaw($this->xssLabel);
    }
  }
}