protected function BlockConfigEntityUnitTest::setUp in Drupal 9
Same name and namespace in other branches
- 8 core/modules/block/tests/src/Unit/BlockConfigEntityUnitTest.php \Drupal\Tests\block\Unit\BlockConfigEntityUnitTest::setUp()
- 10 core/modules/block/tests/src/Unit/BlockConfigEntityUnitTest.php \Drupal\Tests\block\Unit\BlockConfigEntityUnitTest::setUp()
Overrides UnitTestCase::setUp
File
- core/
modules/ block/ tests/ src/ Unit/ BlockConfigEntityUnitTest.php, line 63
Class
- BlockConfigEntityUnitTest
- @coversDefaultClass \Drupal\block\Entity\Block @group block
Namespace
Drupal\Tests\block\UnitCode
protected function setUp() : void {
$this->entityTypeId = $this
->randomMachineName();
$this->entityType = $this
->createMock('\\Drupal\\Core\\Entity\\EntityTypeInterface');
$this->entityType
->expects($this
->any())
->method('getProvider')
->will($this
->returnValue('block'));
$this->entityTypeManager = $this
->createMock(EntityTypeManagerInterface::class);
$this->entityTypeManager
->expects($this
->any())
->method('getDefinition')
->with($this->entityTypeId)
->will($this
->returnValue($this->entityType));
$this->uuid = $this
->createMock('\\Drupal\\Component\\Uuid\\UuidInterface');
$this->moduleHandler = $this
->prophesize(ModuleHandlerInterface::class);
$this->themeHandler = $this
->prophesize(ThemeHandlerInterface::class);
$container = new ContainerBuilder();
$container
->set('entity_type.manager', $this->entityTypeManager);
$container
->set('module_handler', $this->moduleHandler
->reveal());
$container
->set('theme_handler', $this->themeHandler
->reveal());
$container
->set('uuid', $this->uuid);
\Drupal::setContainer($container);
}