function LayoutPluginManagerTest::testGetGroupedDefinitions

Same name and namespace in other branches
  1. 9 core/tests/Drupal/Tests/Core/Layout/LayoutPluginManagerTest.php \Drupal\Tests\Core\Layout\LayoutPluginManagerTest::testGetGroupedDefinitions()
  2. 10 core/tests/Drupal/Tests/Core/Layout/LayoutPluginManagerTest.php \Drupal\Tests\Core\Layout\LayoutPluginManagerTest::testGetGroupedDefinitions()
  3. 11.x core/tests/Drupal/Tests/Core/Layout/LayoutPluginManagerTest.php \Drupal\Tests\Core\Layout\LayoutPluginManagerTest::testGetGroupedDefinitions()

@covers ::getGroupedDefinitions

File

core/tests/Drupal/Tests/Core/Layout/LayoutPluginManagerTest.php, line 278

Class

LayoutPluginManagerTest
@coversDefaultClass <a href="/api/drupal/core%21lib%21Drupal%21Core%21Layout%21LayoutPluginManager.php/class/LayoutPluginManager/8.9.x" title="Provides a plugin manager for layouts." class="local">\Drupal\Core\Layout\LayoutPluginManager</a> @group Layout

Namespace

Drupal\Tests\Core\Layout

Code

public function testGetGroupedDefinitions() {
    $category_expected = [
        'Columns: 1' => [
            'module_a_provided_layout',
            'plugin_provided_layout',
        ],
        'Columns: 2' => [
            'theme_a_provided_layout',
        ],
    ];
    $definitions = $this->layoutPluginManager
        ->getGroupedDefinitions();
    $this->assertEquals(array_keys($category_expected), array_keys($definitions));
    foreach ($category_expected as $category => $expected) {
        $this->assertArrayHasKey($category, $definitions);
        $this->assertEquals($expected, array_keys($definitions[$category]));
        $this->assertContainsOnlyInstancesOf(LayoutDefinition::class, $definitions[$category]);
    }
}

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