You are here

function ThemeTest::testTaxonomyTermThemes in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 core/modules/taxonomy/src/Tests/ThemeTest.php \Drupal\taxonomy\Tests\ThemeTest::testTaxonomyTermThemes()

Test the theme used when adding, viewing and editing taxonomy terms.

File

core/modules/taxonomy/src/Tests/ThemeTest.php, line 37
Contains \Drupal\taxonomy\Tests\ThemeTest.

Class

ThemeTest
Verifies that various taxonomy pages use the expected theme.

Namespace

Drupal\taxonomy\Tests

Code

function testTaxonomyTermThemes() {

  // Adding a term to a vocabulary is considered an administrative action and
  // should use the administrative theme.
  $vocabulary = $this
    ->createVocabulary();
  $this
    ->drupalGet('admin/structure/taxonomy/manage/' . $vocabulary
    ->id() . '/add');
  $this
    ->assertRaw('seven/css/base/elements.css', t("The administrative theme's CSS appears on the page for adding a taxonomy term."));

  // Viewing a taxonomy term should use the default theme.
  $term = $this
    ->createTerm($vocabulary);
  $this
    ->drupalGet('taxonomy/term/' . $term
    ->id());
  $this
    ->assertRaw('bartik/css/base/elements.css', t("The default theme's CSS appears on the page for viewing a taxonomy term."));

  // Editing a taxonomy term should use the same theme as adding one.
  $this
    ->drupalGet('taxonomy/term/' . $term
    ->id() . '/edit');
  $this
    ->assertRaw('seven/css/base/elements.css', t("The administrative theme's CSS appears on the page for editing a taxonomy term."));
}