function EntityTest::setUp

Same name in this branch
  1. main core/modules/views/tests/src/Unit/Plugin/argument_validator/EntityTest.php \Drupal\Tests\views\Unit\Plugin\argument_validator\EntityTest::setUp()
Same name and namespace in other branches
  1. 11.x core/modules/views/tests/src/Unit/Plugin/argument_validator/EntityTest.php \Drupal\Tests\views\Unit\Plugin\argument_validator\EntityTest::setUp()
  2. 11.x core/modules/views/tests/src/Unit/Plugin/area/EntityTest.php \Drupal\Tests\views\Unit\Plugin\area\EntityTest::setUp()
  3. 10 core/modules/views/tests/src/Unit/Plugin/argument_validator/EntityTest.php \Drupal\Tests\views\Unit\Plugin\argument_validator\EntityTest::setUp()
  4. 10 core/modules/views/tests/src/Unit/Plugin/area/EntityTest.php \Drupal\Tests\views\Unit\Plugin\area\EntityTest::setUp()
  5. 9 core/modules/views/tests/src/Unit/Plugin/argument_validator/EntityTest.php \Drupal\Tests\views\Unit\Plugin\argument_validator\EntityTest::setUp()
  6. 9 core/modules/views/tests/src/Unit/Plugin/area/EntityTest.php \Drupal\Tests\views\Unit\Plugin\area\EntityTest::setUp()
  7. 8.9.x core/modules/views/tests/src/Unit/Plugin/argument_validator/EntityTest.php \Drupal\Tests\views\Unit\Plugin\argument_validator\EntityTest::setUp()
  8. 8.9.x core/modules/views/tests/src/Unit/Plugin/area/EntityTest.php \Drupal\Tests\views\Unit\Plugin\area\EntityTest::setUp()

Overrides UnitTestCase::setUp

File

core/modules/views/tests/src/Unit/Plugin/area/EntityTest.php, line 96

Class

EntityTest
Tests Drupal\views\Plugin\views\area\Entity.

Namespace

Drupal\Tests\views\Unit\Plugin\area

Code

protected function setUp() : void {
  parent::setUp();
  $this->entityTypeManager = $this->createStub(EntityTypeManagerInterface::class);
  $this->entityRepository = $this->createStub(EntityRepositoryInterface::class);
  $this->entityDisplayRepository = $this->createStub(EntityDisplayRepositoryInterface::class);
  $this->entityStorage = $this->createStub(EntityStorageInterface::class);
  $this->entityViewBuilder = $this->createStub(EntityViewBuilderInterface::class);
  $this->display = $this->createStub(DisplayPluginBase::class);
  $this->entityHandler = new Entity([], 'entity', [
    'entity_type' => 'entity_test',
  ], $this->entityTypeManager, $this->entityRepository, $this->entityDisplayRepository);
  $token = $this->createStub(Token::class);
  $token->method('replace')
    ->willReturnArgument(0);
  $container = new ContainerBuilder();
  $container->set('token', $token);
  \Drupal::setContainer($container);
}

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