function LayoutPluginManagerExceptionTest::testProcessDefinitionWithMissingLayoutLabel

Tests ::processDefinition() with a layout that doesn't have a label.

@legacy-covers ::processDefinition

File

core/tests/Drupal/Tests/Core/Layout/LayoutPluginManagerExceptionTest.php, line 31

Class

LayoutPluginManagerExceptionTest
Tests Drupal\Core\Layout\LayoutPluginManager exceptions.

Namespace

Drupal\Tests\Core\Layout

Code

public function testProcessDefinitionWithMissingLayoutLabel() : void {
  $this->expectException(InvalidPluginDefinitionException::class);
  $this->expectExceptionMessage('The "test_layout" layout definition must have a label.');
  $definition = new LayoutDefinition([
    'id' => 'a_label_less_layout',
    'class' => LayoutDefault::class,
  ]);
  $layoutPluginManager = new LayoutPluginManager(new \ArrayObject([
    'Drupal\\Core',
  ]), $this->createStub(CacheBackendInterface::class), $this->createStub(ModuleHandlerInterface::class), $this->createStub(ThemeHandlerInterface::class));
  $layoutPluginManager->processDefinition($definition, 'test_layout');
}

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