protected function EntityTest::setUp in Drupal 8
Same name in this branch
- 8 core/modules/views/tests/src/Unit/Plugin/area/EntityTest.php \Drupal\Tests\views\Unit\Plugin\area\EntityTest::setUp()
- 8 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
- 9 core/modules/views/tests/src/Unit/Plugin/area/EntityTest.php \Drupal\Tests\views\Unit\Plugin\area\EntityTest::setUp()
- 10 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 84
Class
- EntityTest
- @coversDefaultClass \Drupal\views\Plugin\views\area\Entity @group Entity
Namespace
Drupal\Tests\views\Unit\Plugin\areaCode
protected function setUp() {
parent::setUp();
$this->entityTypeManager = $this
->createMock(EntityTypeManagerInterface::class);
$this->entityRepository = $this
->createMock(EntityRepositoryInterface::class);
$this->entityDisplayRepository = $this
->createMock(EntityDisplayRepositoryInterface::class);
$this->entityStorage = $this
->createMock('Drupal\\Core\\Entity\\EntityStorageInterface');
$this->entityViewBuilder = $this
->createMock('Drupal\\Core\\Entity\\EntityViewBuilderInterface');
$this->executable = $this
->getMockBuilder('Drupal\\views\\ViewExecutable')
->disableOriginalConstructor()
->getMock();
$this->display = $this
->getMockBuilder('Drupal\\views\\Plugin\\views\\display\\DisplayPluginBase')
->disableOriginalConstructor()
->getMock();
$this->stylePlugin = $this
->getMockBuilder('Drupal\\views\\Plugin\\views\\style\\StylePluginBase')
->disableOriginalConstructor()
->getMock();
$this->executable->style_plugin = $this->stylePlugin;
$this->entityHandler = new Entity([], 'entity', [
'entity_type' => 'entity_test',
], $this->entityTypeManager, $this->entityRepository, $this->entityDisplayRepository);
$this->display
->expects($this
->any())
->method('getPlugin')
->with('style')
->willReturn($this->stylePlugin);
$this->executable
->expects($this
->any())
->method('getStyle')
->willReturn($this->stylePlugin);
$token = $this
->getMockBuilder('Drupal\\Core\\Utility\\Token')
->disableOriginalConstructor()
->getMock();
$token
->expects($this
->any())
->method('replace')
->willReturnArgument(0);
$container = new ContainerBuilder();
$container
->set('token', $token);
\Drupal::setContainer($container);
}