You are here

public function ThemeHandlerTest::testRebuildThemeData in Drupal 8

Same name and namespace in other branches
  1. 9 core/tests/Drupal/Tests/Core/Extension/ThemeHandlerTest.php \Drupal\Tests\Core\Extension\ThemeHandlerTest::testRebuildThemeData()

Tests rebuilding the theme data.

See also

\Drupal\Core\Extension\ThemeHandler::rebuildThemeData()

File

core/tests/Drupal/Tests/Core/Extension/ThemeHandlerTest.php, line 76
Contains \Drupal\Tests\Core\Extension\ThemeHandlerTest.

Class

ThemeHandlerTest
@coversDefaultClass \Drupal\Core\Extension\ThemeHandler @group Extension

Namespace

Drupal\Tests\Core\Extension

Code

public function testRebuildThemeData() {
  $this->themeList
    ->expects($this
    ->at(0))
    ->method('reset')
    ->willReturnSelf();
  $this->themeList
    ->expects($this
    ->at(1))
    ->method('getList')
    ->will($this
    ->returnValue([
    'seven' => new Extension($this->root, 'theme', 'core/themes/seven/seven.info.yml', 'seven.theme'),
  ]));
  $theme_data = $this->themeHandler
    ->rebuildThemeData();
  $this
    ->assertCount(1, $theme_data);
  $info = $theme_data['seven'];

  // Ensure some basic properties.
  $this
    ->assertInstanceOf('Drupal\\Core\\Extension\\Extension', $info);
  $this
    ->assertEquals('seven', $info
    ->getName());
  $this
    ->assertEquals('core/themes/seven/seven.info.yml', $info
    ->getPathname());
  $this
    ->assertEquals('core/themes/seven/seven.theme', $info
    ->getExtensionPathname());
}