You are here

public function LayoutPluginManagerTest::testProcessDefinition in Drupal 9

Same name and namespace in other branches
  1. 8 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 203

Class

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

Namespace

Drupal\Tests\Core\Layout

Code

public function testProcessDefinition() {
  $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();
}