You are here

public function LayoutPluginManagerTest::testGetGroupedDefinitions in Drupal 8

Same name and namespace in other branches
  1. 9 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 \Drupal\Core\Layout\LayoutPluginManager @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]);
  }
}