You are here

protected function EditorConfigEntityUnitTest::setUp in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/editor/tests/src/Unit/EditorConfigEntityUnitTest.php \Drupal\Tests\editor\Unit\EditorConfigEntityUnitTest::setUp()

Overrides UnitTestCase::setUp

File

core/modules/editor/tests/src/Unit/EditorConfigEntityUnitTest.php, line 65
Contains \Drupal\Tests\editor\Unit\EditorConfigEntityUnitTest.

Class

EditorConfigEntityUnitTest
@coversDefaultClass \Drupal\editor\Entity\Editor @group editor

Namespace

Drupal\Tests\editor\Unit

Code

protected function setUp() {
  $this->editorId = $this
    ->randomMachineName();
  $this->entityTypeId = $this
    ->randomMachineName();
  $this->entityType = $this
    ->getMock('\\Drupal\\Core\\Entity\\EntityTypeInterface');
  $this->entityType
    ->expects($this
    ->any())
    ->method('getProvider')
    ->will($this
    ->returnValue('editor'));
  $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');
  $this->editorPluginManager = $this
    ->getMockBuilder('Drupal\\editor\\Plugin\\EditorManager')
    ->disableOriginalConstructor()
    ->getMock();
  $container = new ContainerBuilder();
  $container
    ->set('entity.manager', $this->entityManager);
  $container
    ->set('uuid', $this->uuid);
  $container
    ->set('plugin.manager.editor', $this->editorPluginManager);
  \Drupal::setContainer($container);
}