public function PluginManagerTest::testGetLibraryInfo in Layout Plugin (obsolete, use core's Layout Discovery) 8
Tests layout plugin library info.
@covers ::getLibraryInfo
File
- tests/
src/ Unit/ PluginManagerTest.php, line 314
Class
- PluginManagerTest
- Tests the LayoutPluginManager.
Namespace
Drupal\Tests\layout_plugin\UnitCode
public function testGetLibraryInfo() {
/** @var \Drupal\layout_plugin\Plugin\Layout\LayoutPluginManager|\PHPUnit_Framework_MockObject_MockObject $layout_manager */
$layout_manager = $this
->getMockBuilder('Drupal\\layout_plugin\\Plugin\\Layout\\LayoutPluginManager')
->disableOriginalConstructor()
->setMethods([
'getDefinitions',
'getProviderVersion',
])
->getMock();
$layout_manager
->method('getDefinitions')
->willReturn([
// Should get template registered automatically.
'simple_layout' => [
'css' => 'modules/layout_plugin_test/layouts/simple_layout/simple-layout.css',
'library' => 'layout_plugin/simple_layout',
'provider_type' => 'module',
'provider' => 'layout_plugin_test',
],
'theme_layout' => [
'css' => 'themes/theme_with_layout/layouts/theme_layout/theme-layout.css',
'library' => 'layout_plugin/theme_layout',
'provider_type' => 'theme',
'provider' => 'theme_with_layout',
],
'complex_layout' => [
'library' => 'layout_plugin_test/complex_layout',
],
]);
$layout_manager
->method('getProviderVersion')
->willReturnMap([
[
'module',
'layout_plugin_test',
'1.2.3',
],
[
'theme',
'theme_with_layout',
'2.3.4',
],
]);
$library_info = $layout_manager
->getLibraryInfo();
$this
->assertEquals([
'simple_layout' => [
'version' => '1.2.3',
'css' => [
'theme' => [
'/modules/layout_plugin_test/layouts/simple_layout/simple-layout.css' => [],
],
],
],
'theme_layout' => [
'version' => '2.3.4',
'css' => [
'theme' => [
'/themes/theme_with_layout/layouts/theme_layout/theme-layout.css' => [],
],
],
],
], $library_info);
}