function SystemLocalTasksTest::setUp

Same name in other branches
  1. 9 core/modules/system/tests/src/Unit/Menu/SystemLocalTasksTest.php \Drupal\Tests\system\Unit\Menu\SystemLocalTasksTest::setUp()
  2. 8.9.x core/modules/system/tests/src/Unit/Menu/SystemLocalTasksTest.php \Drupal\Tests\system\Unit\Menu\SystemLocalTasksTest::setUp()
  3. 11.x core/modules/system/tests/src/Unit/Menu/SystemLocalTasksTest.php \Drupal\Tests\system\Unit\Menu\SystemLocalTasksTest::setUp()

Overrides LocalTaskIntegrationTestBase::setUp

File

core/modules/system/tests/src/Unit/Menu/SystemLocalTasksTest.php, line 29

Class

SystemLocalTasksTest
Tests existence of system local tasks.

Namespace

Drupal\Tests\system\Unit\Menu

Code

protected function setUp() : void {
    parent::setUp();
    $this->directoryList = [
        'system' => 'core/modules/system',
    ];
    $this->themeHandler = $this->createMock('Drupal\\Core\\Extension\\ThemeHandlerInterface');
    $theme = new Extension($this->root, 'theme', 'core/themes/olivero', 'olivero.info.yml');
    $theme->status = 1;
    $theme->info = [
        'name' => 'olivero',
    ];
    $this->themeHandler
        ->expects($this->any())
        ->method('listInfo')
        ->willReturn([
        'olivero' => $theme,
    ]);
    $this->themeHandler
        ->expects($this->any())
        ->method('hasUi')
        ->with('olivero')
        ->willReturn(TRUE);
    $this->container
        ->set('theme_handler', $this->themeHandler);
    $fooEntityDefinition = $this->createMock(EntityTypeInterface::class);
    $fooEntityDefinition->expects($this->once())
        ->method('hasLinkTemplate')
        ->with('version-history')
        ->willReturn(TRUE);
    $entityTypeManager = $this->createMock(EntityTypeManagerInterface::class);
    $entityTypeManager->expects($this->any())
        ->method('getDefinitions')
        ->willReturn([
        'foo' => $fooEntityDefinition,
    ]);
    $this->container
        ->set('entity_type.manager', $entityTypeManager);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.