ThemeEarlyInitializationTest.php 958 Bytes
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12
<?php

/**
 * @file
 * Definition of Drupal\system\Tests\Theme\ThemeEarlyInitializationTest.
 */

namespace Drupal\system\Tests\Theme;

use Drupal\simpletest\WebTestBase;

/**
13 14 15 16
 * Tests that the theme system can be correctly initialized early in the page
 * request.
 *
 * @group Theme
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
 */
class ThemeEarlyInitializationTest extends WebTestBase {

  /**
   * Modules to enable.
   *
   * @var array
   */
  public static $modules = array('theme_test');

  /**
   * Test that the theme system can generate output in a request listener.
   */
  function testRequestListener() {
    $this->drupalGet('theme-test/request-listener');
    // Verify that themed output generated in the request listener appears.
    $this->assertRaw('Themed output generated in a KernelEvents::REQUEST listener');
    // Verify that the default theme's CSS still appears even though the theme
    // system was initialized early.
36
    $this->assertRaw('classy/css/layout.css');
37 38
  }
}