protected function BlockRepositoryTest::setUp in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/block/tests/src/Unit/BlockRepositoryTest.php \Drupal\Tests\block\Unit\BlockRepositoryTest::setUp()
Overrides UnitTestCase::setUp
File
- core/
modules/ block/ tests/ src/ Unit/ BlockRepositoryTest.php, line 45 - Contains \Drupal\Tests\block\Unit\BlockRepositoryTest.
Class
- BlockRepositoryTest
- @coversDefaultClass \Drupal\block\BlockRepository @group block
Namespace
Drupal\Tests\block\UnitCode
protected function setUp() {
parent::setUp();
$active_theme = $this
->getMockBuilder('Drupal\\Core\\Theme\\ActiveTheme')
->disableOriginalConstructor()
->getMock();
$this->theme = $this
->randomMachineName();
$active_theme
->expects($this
->atLeastOnce())
->method('getName')
->willReturn($this->theme);
$active_theme
->expects($this
->atLeastOnce())
->method('getRegions')
->willReturn([
'top',
'center',
'bottom',
]);
$theme_manager = $this
->getMock('Drupal\\Core\\Theme\\ThemeManagerInterface');
$theme_manager
->expects($this
->atLeastOnce())
->method('getActiveTheme')
->will($this
->returnValue($active_theme));
$this->contextHandler = $this
->getMock('Drupal\\Core\\Plugin\\Context\\ContextHandlerInterface');
$this->blockStorage = $this
->getMock('Drupal\\Core\\Entity\\EntityStorageInterface');
$entity_manager = $this
->getMock('Drupal\\Core\\Entity\\EntityManagerInterface');
$entity_manager
->expects($this
->any())
->method('getStorage')
->willReturn($this->blockStorage);
$this->blockRepository = new BlockRepository($entity_manager, $theme_manager, $this->contextHandler);
}