Chris@0
|
1 <?php
|
Chris@0
|
2
|
Chris@0
|
3 namespace Drupal\Tests\taxonomy\Functional;
|
Chris@0
|
4
|
Chris@0
|
5 /**
|
Chris@0
|
6 * Verifies that various taxonomy pages use the expected theme.
|
Chris@0
|
7 *
|
Chris@0
|
8 * @group taxonomy
|
Chris@0
|
9 */
|
Chris@0
|
10 class ThemeTest extends TaxonomyTestBase {
|
Chris@0
|
11
|
Chris@0
|
12 protected function setUp() {
|
Chris@0
|
13 parent::setUp();
|
Chris@0
|
14
|
Chris@0
|
15 // Make sure we are using distinct default and administrative themes for
|
Chris@0
|
16 // the duration of these tests.
|
Chris@0
|
17 \Drupal::service('theme_handler')->install(['bartik', 'seven']);
|
Chris@0
|
18 $this->config('system.theme')
|
Chris@0
|
19 ->set('default', 'bartik')
|
Chris@0
|
20 ->set('admin', 'seven')
|
Chris@0
|
21 ->save();
|
Chris@0
|
22
|
Chris@0
|
23 // Create and log in as a user who has permission to add and edit taxonomy
|
Chris@0
|
24 // terms and view the administrative theme.
|
Chris@0
|
25 $admin_user = $this->drupalCreateUser(['administer taxonomy', 'view the administration theme']);
|
Chris@0
|
26 $this->drupalLogin($admin_user);
|
Chris@0
|
27 }
|
Chris@0
|
28
|
Chris@0
|
29 /**
|
Chris@0
|
30 * Test the theme used when adding, viewing and editing taxonomy terms.
|
Chris@0
|
31 */
|
Chris@0
|
32 public function testTaxonomyTermThemes() {
|
Chris@0
|
33 // Adding a term to a vocabulary is considered an administrative action and
|
Chris@0
|
34 // should use the administrative theme.
|
Chris@0
|
35 $vocabulary = $this->createVocabulary();
|
Chris@0
|
36 $this->drupalGet('admin/structure/taxonomy/manage/' . $vocabulary->id() . '/add');
|
Chris@0
|
37 $this->assertRaw('seven/css/base/elements.css', t("The administrative theme's CSS appears on the page for adding a taxonomy term."));
|
Chris@0
|
38
|
Chris@0
|
39 // Viewing a taxonomy term should use the default theme.
|
Chris@0
|
40 $term = $this->createTerm($vocabulary);
|
Chris@0
|
41 $this->drupalGet('taxonomy/term/' . $term->id());
|
Chris@0
|
42 $this->assertRaw('bartik/css/base/elements.css', t("The default theme's CSS appears on the page for viewing a taxonomy term."));
|
Chris@0
|
43
|
Chris@0
|
44 // Editing a taxonomy term should use the same theme as adding one.
|
Chris@0
|
45 $this->drupalGet('taxonomy/term/' . $term->id() . '/edit');
|
Chris@0
|
46 $this->assertRaw('seven/css/base/elements.css', t("The administrative theme's CSS appears on the page for editing a taxonomy term."));
|
Chris@0
|
47 }
|
Chris@0
|
48
|
Chris@0
|
49 }
|