You are here

protected function BlockLocalTasksTest::setUp in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 core/modules/block/tests/src/Unit/Menu/BlockLocalTasksTest.php \Drupal\Tests\block\Unit\Menu\BlockLocalTasksTest::setUp()

Overrides LocalTaskIntegrationTestBase::setUp

File

core/modules/block/tests/src/Unit/Menu/BlockLocalTasksTest.php, line 20
Contains \Drupal\Tests\block\Unit\Menu\BlockLocalTasksTest.

Class

BlockLocalTasksTest
Tests block local tasks.

Namespace

Drupal\Tests\block\Unit\Menu

Code

protected function setUp() {
  $this->directoryList = array(
    'block' => 'core/modules/block',
  );
  parent::setUp();
  $config_factory = $this
    ->getConfigFactoryStub(array(
    'system.theme' => array(
      'default' => 'test_c',
    ),
  ));
  $themes = array();
  $themes['test_a'] = (object) array(
    'status' => 1,
    'info' => array(
      'name' => 'test_a',
      'hidden' => TRUE,
    ),
  );
  $themes['test_b'] = (object) array(
    'status' => 1,
    'info' => array(
      'name' => 'test_b',
    ),
  );
  $themes['test_c'] = (object) array(
    'status' => 1,
    'info' => array(
      'name' => 'test_c',
    ),
  );
  $theme_handler = $this
    ->getMock('Drupal\\Core\\Extension\\ThemeHandlerInterface');
  $theme_handler
    ->expects($this
    ->any())
    ->method('listInfo')
    ->will($this
    ->returnValue($themes));
  $theme_handler
    ->expects($this
    ->any())
    ->method('hasUi')
    ->willReturnMap([
    [
      'test_a',
      FALSE,
    ],
    [
      'test_b',
      TRUE,
    ],
    [
      'test_c',
      TRUE,
    ],
  ]);
  $container = new ContainerBuilder();
  $container
    ->set('config.factory', $config_factory);
  $container
    ->set('theme_handler', $theme_handler);
  $container
    ->set('app.root', $this->root);
  \Drupal::setContainer($container);
}