function ThemeHandlerTest::testThemeLibrariesEmpty

Same name and namespace in other branches
  1. 8.9.x core/tests/Drupal/Tests/Core/Extension/ThemeHandlerTest.php \Drupal\Tests\Core\Extension\ThemeHandlerTest::testThemeLibrariesEmpty()
  2. 10 core/tests/Drupal/Tests/Core/Extension/ThemeHandlerTest.php \Drupal\Tests\Core\Extension\ThemeHandlerTest::testThemeLibrariesEmpty()
  3. 11.x core/tests/Drupal/Tests/Core/Extension/ThemeHandlerTest.php \Drupal\Tests\Core\Extension\ThemeHandlerTest::testThemeLibrariesEmpty()

Tests empty libraries in theme.info.yml file.

File

core/tests/Drupal/Tests/Core/Extension/ThemeHandlerTest.php, line 101

Class

ThemeHandlerTest
@coversDefaultClass <a href="/api/drupal/core%21lib%21Drupal%21Core%21Extension%21ThemeHandler.php/class/ThemeHandler/9" title="Default theme handler using the config system to store installation statuses." class="local">\Drupal\Core\Extension\ThemeHandler</a> @group Extension

Namespace

Drupal\Tests\Core\Extension

Code

public function testThemeLibrariesEmpty() {
    $theme = new Extension($this->root, 'theme', 'core/modules/system/tests/themes/test_theme_libraries_empty', 'test_theme_libraries_empty.info.yml');
    try {
        $this->themeHandler
            ->addTheme($theme);
        $this->assertTrue(TRUE, 'Empty libraries key in theme.info.yml does not cause PHP warning');
    } catch (\Exception $e) {
        $this->fail('Empty libraries key in theme.info.yml causes PHP warning.');
    }
}

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