function ThemeInfoTest::testChanges

Same name in other branches
  1. 9 core/modules/system/tests/src/Functional/Theme/ThemeInfoTest.php \Drupal\Tests\system\Functional\Theme\ThemeInfoTest::testChanges()
  2. 10 core/modules/system/tests/src/Functional/Theme/ThemeInfoTest.php \Drupal\Tests\system\Functional\Theme\ThemeInfoTest::testChanges()
  3. 11.x core/modules/system/tests/src/Functional/Theme/ThemeInfoTest.php \Drupal\Tests\system\Functional\Theme\ThemeInfoTest::testChanges()

Tests that changes to the info file are picked up.

File

core/modules/system/tests/src/Functional/Theme/ThemeInfoTest.php, line 90

Class

ThemeInfoTest
Tests processing of theme .info.yml properties.

Namespace

Drupal\Tests\system\Functional\Theme

Code

public function testChanges() {
    $this->themeInstaller
        ->install([
        'test_theme',
    ]);
    $this->config('system.theme')
        ->set('default', 'test_theme')
        ->save();
    $this->themeManager
        ->resetActiveTheme();
    $active_theme = $this->themeManager
        ->getActiveTheme();
    // Make sure we are not testing the wrong theme.
    $this->assertEqual('test_theme', $active_theme->getName());
    $this->assertEqual([
        'classy/base',
        'classy/messages',
        'core/normalize',
        'test_theme/global-styling',
    ], $active_theme->getLibraries());
    // @see theme_test_system_info_alter()
    $this->state
        ->set('theme_test.modify_info_files', TRUE);
    drupal_flush_all_caches();
    $active_theme = $this->themeManager
        ->getActiveTheme();
    $this->assertEqual([
        'classy/base',
        'classy/messages',
        'core/normalize',
        'test_theme/global-styling',
        'core/backbone',
    ], $active_theme->getLibraries());
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.