You are here

protected function EntityTest::setUp in Zircon Profile 8

Same name in this branch
  1. 8 core/modules/hal/src/Tests/EntityTest.php \Drupal\hal\Tests\EntityTest::setUp()
  2. 8 core/modules/views/tests/src/Unit/Plugin/area/EntityTest.php \Drupal\Tests\views\Unit\Plugin\area\EntityTest::setUp()
  3. 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
  1. 8.0 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 72
Contains \Drupal\Tests\views\Unit\Plugin\area\EntityTest.

Class

EntityTest
@coversDefaultClass \Drupal\views\Plugin\views\area\Entity @group Entity

Namespace

Drupal\Tests\views\Unit\Plugin\area

Code

protected function setUp() {
  parent::setUp();
  $this->entityManager = $this
    ->getMock('Drupal\\Core\\Entity\\EntityManagerInterface');
  $this->entityStorage = $this
    ->getMock('Drupal\\Core\\Entity\\EntityStorageInterface');
  $this->entityViewBuilder = $this
    ->getMock('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(array(), 'entity', array(
    'entity_type' => 'entity_test',
  ), $this->entityManager);
  $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);
}