Esempio n. 1
0
 /**
  * {@inheritdoc}
  */
 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);
     $theme_manager = $this->getMock('Drupal\\Core\\Theme\\ThemeManagerInterface');
     $theme_manager->expects($this->once())->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 = $this->getMockBuilder('Drupal\\block\\BlockRepository')->setConstructorArgs([$entity_manager, $theme_manager, $this->contextHandler])->setMethods(['getRegionNames'])->getMock();
     $this->blockRepository->expects($this->once())->method('getRegionNames')->willReturn(['top' => 'Top', 'center' => 'Center', 'bottom' => 'Bottom']);
 }