function EntityLinkTest::setUp

Same name in this branch
  1. 11.x core/modules/comment/tests/src/Unit/Plugin/views/field/EntityLinkTest.php \Drupal\Tests\comment\Unit\Plugin\views\field\EntityLinkTest::setUp()
Same name in other branches
  1. 9 core/tests/Drupal/Tests/Core/Entity/EntityLinkTest.php \Drupal\Tests\Core\Entity\EntityLinkTest::setUp()
  2. 8.9.x core/tests/Drupal/Tests/Core/Entity/EntityLinkTest.php \Drupal\Tests\Core\Entity\EntityLinkTest::setUp()
  3. 10 core/modules/comment/tests/src/Unit/Plugin/views/field/EntityLinkTest.php \Drupal\Tests\comment\Unit\Plugin\views\field\EntityLinkTest::setUp()
  4. 10 core/tests/Drupal/Tests/Core/Entity/EntityLinkTest.php \Drupal\Tests\Core\Entity\EntityLinkTest::setUp()

Overrides UnitTestCase::setUp

File

core/tests/Drupal/Tests/Core/Entity/EntityLinkTest.php, line 44

Class

EntityLinkTest
@coversDefaultClass \Drupal\Core\Entity\EntityBase @group Entity

Namespace

Drupal\Tests\Core\Entity

Code

protected function setUp() : void {
    parent::setUp();
    $this->entityTypeManager = $this->createMock(EntityTypeManagerInterface::class);
    $this->linkGenerator = $this->createMock('Drupal\\Core\\Utility\\LinkGeneratorInterface');
    $this->languageManager = $this->createMock('Drupal\\Core\\Language\\LanguageManagerInterface');
    $container = new ContainerBuilder();
    $container->set('entity_type.manager', $this->entityTypeManager);
    $container->set('link_generator', $this->linkGenerator);
    $container->set('language_manager', $this->languageManager);
    \Drupal::setContainer($container);
}

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