function LayoutTest::testThemeProvidedLayout

Same name in other branches
  1. 8.9.x core/modules/layout_discovery/tests/src/Kernel/LayoutTest.php \Drupal\Tests\layout_discovery\Kernel\LayoutTest::testThemeProvidedLayout()
  2. 10 core/modules/layout_discovery/tests/src/Kernel/LayoutTest.php \Drupal\Tests\layout_discovery\Kernel\LayoutTest::testThemeProvidedLayout()
  3. 11.x core/modules/layout_discovery/tests/src/Kernel/LayoutTest.php \Drupal\Tests\layout_discovery\Kernel\LayoutTest::testThemeProvidedLayout()

Tests that a layout provided by a theme has the preprocess function set.

File

core/modules/layout_discovery/tests/src/Kernel/LayoutTest.php, line 39

Class

LayoutTest
Tests Layout functionality.

Namespace

Drupal\Tests\layout_discovery\Kernel

Code

public function testThemeProvidedLayout() {
    $this->container
        ->get('theme_installer')
        ->install([
        'test_layout_theme',
    ]);
    $this->config('system.theme')
        ->set('default', 'test_layout_theme')
        ->save();
    $theme_definitions = $this->container
        ->get('theme.registry')
        ->get();
    $this->assertContains('template_preprocess_layout', $theme_definitions['test_layout_theme']['preprocess functions']);
}

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