function EditorConfigEntityUnitTest::setUp

Same name and namespace in other branches
  1. 8.9.x core/modules/editor/tests/src/Unit/EditorConfigEntityUnitTest.php \Drupal\Tests\editor\Unit\EditorConfigEntityUnitTest::setUp()
  2. 10 core/modules/editor/tests/src/Unit/EditorConfigEntityUnitTest.php \Drupal\Tests\editor\Unit\EditorConfigEntityUnitTest::setUp()
  3. 11.x 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 61

Class

EditorConfigEntityUnitTest
@coversDefaultClass <a href="/api/drupal/core%21modules%21editor%21src%21Entity%21Editor.php/class/Editor/9" title="Defines the configured text editor entity." class="local">\Drupal\editor\Entity\Editor</a> @group editor

Namespace

Drupal\Tests\editor\Unit

Code

protected function setUp() : void {
    $this->editorId = $this->randomMachineName();
    $this->entityTypeId = $this->randomMachineName();
    $this->entityType = $this->createMock('\\Drupal\\Core\\Entity\\EntityTypeInterface');
    $this->entityType
        ->expects($this->any())
        ->method('getProvider')
        ->willReturn('editor');
    $this->entityTypeManager = $this->createMock(EntityTypeManagerInterface::class);
    $this->entityTypeManager
        ->expects($this->any())
        ->method('getDefinition')
        ->with($this->entityTypeId)
        ->willReturn($this->entityType);
    $this->uuid = $this->createMock('\\Drupal\\Component\\Uuid\\UuidInterface');
    $this->editorPluginManager = $this->getMockBuilder('Drupal\\editor\\Plugin\\EditorManager')
        ->disableOriginalConstructor()
        ->getMock();
    $container = new ContainerBuilder();
    $container->set('entity_type.manager', $this->entityTypeManager);
    $container->set('uuid', $this->uuid);
    $container->set('plugin.manager.editor', $this->editorPluginManager);
    \Drupal::setContainer($container);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.