function LayoutPluginManagerTest::testGetGroupedDefinitions

Same name in other branches
  1. 9 core/tests/Drupal/Tests/Core/Layout/LayoutPluginManagerTest.php \Drupal\Tests\Core\Layout\LayoutPluginManagerTest::testGetGroupedDefinitions()
  2. 8.9.x core/tests/Drupal/Tests/Core/Layout/LayoutPluginManagerTest.php \Drupal\Tests\Core\Layout\LayoutPluginManagerTest::testGetGroupedDefinitions()
  3. 10 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 339

Class

LayoutPluginManagerTest
@coversDefaultClass \Drupal\Core\Layout\LayoutPluginManager @group Layout

Namespace

Drupal\Tests\Core\Layout

Code

public function testGetGroupedDefinitions() : void {
    $category_expected = [
        'Columns: 1' => [
            'module_a_provided_layout',
            'plugin_provided_layout',
        ],
        'Columns: 2' => [
            'theme_a_provided_layout',
            'plugin_provided_by_annotation_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.