1 theme.test ThemeUnitTest::testListThemes()

Test the list_themes() function.

File

core/modules/simpletest/tests/theme.test, line 118
Tests for the theme API.

Class

ThemeUnitTest
Unit tests for the Theme API.

Code

function testListThemes() {
  $themes = list_themes();
  // Check if backdrop_theme_access() retrieves enabled themes properly from list_themes().
  $this->assertTrue(backdrop_theme_access('test_theme'), 'Enabled theme detected');
  // Check if list_themes() returns disabled themes.
  $this->assertTrue(array_key_exists('test_basetheme', $themes), 'Disabled theme detected');
  // Check for base theme and subtheme lists.
  $base_theme_list = array('test_basetheme' => 'Theme test base theme');
  $sub_theme_list = array('test_subtheme' => 'Theme test subtheme');
  $this->assertIdentical($themes['test_basetheme']->sub_themes, $sub_theme_list, 'Base theme\'s object includes list of subthemes.');
  $this->assertIdentical($themes['test_subtheme']->base_themes, $base_theme_list, 'Subtheme\'s object includes list of base themes.');
  // Check for theme engine in subtheme.
  $this->assertIdentical($themes['test_subtheme']->engine, 'phptemplate', 'Subtheme\'s object includes the theme engine.');
  // Check for theme engine prefix.
  $this->assertIdentical($themes['test_basetheme']->prefix, 'phptemplate', 'Base theme\'s object includes the theme engine prefix.');
  $this->assertIdentical($themes['test_subtheme']->prefix, 'phptemplate', 'Subtheme\'s object includes the theme engine prefix.');
}