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. 10 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 246

Class

LayoutPluginManagerTest
@coversDefaultClass <a href="/api/drupal/core%21lib%21Drupal%21Core%21Layout%21LayoutPluginManager.php/class/LayoutPluginManager/11.x" title="Provides a plugin manager for layouts." class="local">\Drupal\Core\Layout\LayoutPluginManager</a> @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.