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

Overrides UnitTestCase::setUp

File

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

Class

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

Namespace

Drupal\Tests\Core\Layout

Code

protected function setUp() : void {
  parent::setUp();
  $this
    ->setUpFilesystem();
  $container = new ContainerBuilder();
  $container
    ->set('string_translation', $this
    ->getStringTranslationStub());
  \Drupal::setContainer($container);
  $this->moduleHandler = $this
    ->prophesize(ModuleHandlerInterface::class);
  $this->moduleHandler
    ->moduleExists('module_a')
    ->willReturn(TRUE);
  $this->moduleHandler
    ->moduleExists('theme_a')
    ->willReturn(FALSE);
  $this->moduleHandler
    ->moduleExists('core')
    ->willReturn(FALSE);
  $this->moduleHandler
    ->moduleExists('invalid_provider')
    ->willReturn(FALSE);
  $module_a = new Extension('vfs://root', 'module', 'modules/module_a/module_a.layouts.yml');
  $this->moduleHandler
    ->getModule('module_a')
    ->willReturn($module_a);
  $this->moduleHandler
    ->getModuleDirectories()
    ->willReturn([
    'module_a' => vfsStream::url('root/modules/module_a'),
  ]);
  $this->moduleHandler
    ->alter('layout', Argument::type('array'))
    ->shouldBeCalled();
  $this->themeHandler = $this
    ->prophesize(ThemeHandlerInterface::class);
  $this->themeHandler
    ->themeExists('theme_a')
    ->willReturn(TRUE);
  $this->themeHandler
    ->themeExists('core')
    ->willReturn(FALSE);
  $this->themeHandler
    ->themeExists('invalid_provider')
    ->willReturn(FALSE);
  $theme_a = new Extension('vfs://root', 'theme', 'themes/theme_a/theme_a.layouts.yml');
  $this->themeHandler
    ->getTheme('theme_a')
    ->willReturn($theme_a);
  $this->themeHandler
    ->getThemeDirectories()
    ->willReturn([
    'theme_a' => vfsStream::url('root/themes/theme_a'),
  ]);
  $this->cacheBackend = $this
    ->prophesize(CacheBackendInterface::class);
  $namespaces = new \ArrayObject([
    'Drupal\\Core' => vfsStream::url('root/core/lib/Drupal/Core'),
  ]);
  $this->layoutPluginManager = new LayoutPluginManager($namespaces, $this->cacheBackend
    ->reveal(), $this->moduleHandler
    ->reveal(), $this->themeHandler
    ->reveal());
}