function LayoutPluginManagerTest::testGetSortedDefinitions

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

Tests get sorted definitions.

File

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

Class

LayoutPluginManagerTest
Tests Drupal\Core\Layout\LayoutPluginManager.

Namespace

Drupal\Tests\Core\Layout

Code

public function testGetSortedDefinitions() : void {
  // Sorted by category first, then label.
  $expected = [
    'module_a_provided_layout',
    'plugin_provided_layout',
    'theme_a_provided_layout',
    'plugin_provided_by_annotation_layout',
  ];
  $layout_definitions = $this->layoutPluginManager
    ->getSortedDefinitions();
  $this->assertEquals($expected, array_keys($layout_definitions));
  $this->assertContainsOnlyInstancesOf(LayoutDefinition::class, $layout_definitions);
}

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