function LayoutPluginManagerTest::testProcessDefinition

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

@covers ::processDefinition

File

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

Class

LayoutPluginManagerTest
@coversDefaultClass \Drupal\Core\Layout\LayoutPluginManager[[api-linebreak]] @group Layout

Namespace

Drupal\Tests\Core\Layout

Code

public function testProcessDefinition() : void {
  $this->moduleHandler
    ->alter('layout', Argument::type('array'))
    ->shouldNotBeCalled();
  $this->expectException(InvalidPluginDefinitionException::class);
  $this->expectExceptionMessage('The "module_a_derived_layout:array_based" layout definition must extend ' . LayoutDefinition::class);
  $module_a_provided_layout = <<<'EOS'
module_a_derived_layout:
  deriver: \Drupal\Tests\Core\Layout\LayoutDeriver
  array_based: true
EOS;
  vfsStream::create([
    'modules' => [
      'module_a' => [
        'module_a.layouts.yml' => $module_a_provided_layout,
      ],
    ],
  ]);
  $this->layoutPluginManager
    ->getDefinitions();
}

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