You are here

protected function BlockConfigEntityUnitTest::setUp in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 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 51
Contains \Drupal\Tests\block\Unit\BlockConfigEntityUnitTest.

Class

BlockConfigEntityUnitTest
@coversDefaultClass \Drupal\block\Entity\Block @group block

Namespace

Drupal\Tests\block\Unit

Code

protected function setUp() {
  $this->entityTypeId = $this
    ->randomMachineName();
  $this->entityType = $this
    ->getMock('\\Drupal\\Core\\Entity\\EntityTypeInterface');
  $this->entityType
    ->expects($this
    ->any())
    ->method('getProvider')
    ->will($this
    ->returnValue('block'));
  $this->entityManager = $this
    ->getMock('\\Drupal\\Core\\Entity\\EntityManagerInterface');
  $this->entityManager
    ->expects($this
    ->any())
    ->method('getDefinition')
    ->with($this->entityTypeId)
    ->will($this
    ->returnValue($this->entityType));
  $this->uuid = $this
    ->getMock('\\Drupal\\Component\\Uuid\\UuidInterface');
  $container = new ContainerBuilder();
  $container
    ->set('entity.manager', $this->entityManager);
  $container
    ->set('uuid', $this->uuid);
  \Drupal::setContainer($container);
}