public function PluginManagerTest::testGetLayoutOptions in Layout Plugin (obsolete, use core's Layout Discovery) 8
Test getting layout options.
@covers ::getLayoutOptions
File
- tests/
src/ Unit/ PluginManagerTest.php, line 123
Class
- PluginManagerTest
- Tests the LayoutPluginManager.
Namespace
Drupal\Tests\layout_plugin\UnitCode
public function testGetLayoutOptions() {
/** @var LayoutPluginManager|\PHPUnit_Framework_MockObject_MockBuilder $layout_manager */
$layout_manager = $this
->getMockBuilder('Drupal\\layout_plugin\\Plugin\\Layout\\LayoutPluginManager')
->disableOriginalConstructor()
->setMethods([
'getDefinitions',
])
->getMock();
$layout_manager
->method('getDefinitions')
->willReturn([
'simple_layout' => [
'label' => 'Simple layout',
'category' => 'Test layouts',
],
'complex_layout' => [
'label' => 'Complex layout',
'category' => 'Test layouts',
],
]);
$options = $layout_manager
->getLayoutOptions();
$this
->assertEquals([
'simple_layout' => 'Simple layout',
'complex_layout' => 'Complex layout',
], $options);
$options = $layout_manager
->getLayoutOptions(array(
'group_by_category' => TRUE,
));
$this
->assertEquals([
'Test layouts' => [
'simple_layout' => 'Simple layout',
'complex_layout' => 'Complex layout',
],
], $options);
}