1 icon.test protected IconTestCase::testThemeIcons()

Tests a theme providing and overriding icons, including sub-themes.

File

core/modules/simpletest/tests/icon.test, line 70
Tests for displaying and overriding icons in Backdrop.

Class

IconTestCase
Tests providing and overriding icons from both modules and themes.

Code

protected function testThemeIcons() {
  // Test overriding an icon with no special situations.
  theme_enable(array('test_theme'));
  config_set('system.core', 'theme_default', 'test_theme');
  $core_path = 'core/modules/simpletest/tests/themes/test_theme/icons/gear.svg';
  $this->assertIconsEqual($core_path, 'gear', FALSE, 'Icon provided by a theme is overridden.');

  // Test an icon nested in a sub-directory and using a theme setting.
  config_set('test_theme.settings', 'icon_directory', 'icons/nested');
  $core_path = 'core/modules/simpletest/tests/themes/test_theme/icons/nested/gear-bold.svg';
  $this->assertIconsEqual($core_path, 'gear-bold', FALSE, 'Icon provided by a theme in a sub-directory uses the correct icon.');

  // Test an icon provided by a sub-theme.
  theme_enable(array('test_subtheme'));
  config_set('system.core', 'theme_default', 'test_subtheme');
  $core_path = 'core/modules/simpletest/tests/themes/test_subtheme/icons/gear.svg';
  $this->assertIconsEqual($core_path, 'gear', FALSE, 'Icon provided by a sub-theme uses the correct icon.');

  // Test an icon provided by a base-theme is used when a sub-theme is active.
  $core_path = 'core/modules/simpletest/tests/themes/test_basetheme/icons/gear-bold.svg';
  $this->assertIconsEqual($core_path, 'gear-bold', FALSE, 'Icon provided by a base-theme uses the correct icon.');
}