You are here

protected function FieldTest::setUp in Drupal 10

Same name in this branch
  1. 10 core/modules/quickedit/tests/src/FunctionalJavascript/FieldTest.php \Drupal\Tests\quickedit\FunctionalJavascript\FieldTest::setUp()
  2. 10 core/modules/views/tests/src/Unit/Plugin/field/FieldTest.php \Drupal\Tests\views\Unit\Plugin\field\FieldTest::setUp()
  3. 10 core/modules/views/tests/src/FunctionalJavascript/Plugin/views/Handler/FieldTest.php \Drupal\Tests\views\FunctionalJavascript\Plugin\views\Handler\FieldTest::setUp()
Same name and namespace in other branches
  1. 8 core/modules/views/tests/src/Unit/Plugin/field/FieldTest.php \Drupal\Tests\views\Unit\Plugin\field\FieldTest::setUp()
  2. 9 core/modules/views/tests/src/Unit/Plugin/field/FieldTest.php \Drupal\Tests\views\Unit\Plugin\field\FieldTest::setUp()

Overrides UnitTestCase::setUp

File

core/modules/views/tests/src/Unit/Plugin/field/FieldTest.php, line 87
Contains \Drupal\Tests\views\Unit\Plugin\field\FieldTest.

Class

FieldTest
@coversDefaultClass \Drupal\views\Plugin\views\field\EntityField @group views

Namespace

Drupal\Tests\views\Unit\Plugin\field

Code

protected function setUp() : void {
  parent::setUp();
  $this->entityTypeManager = $this
    ->createMock(EntityTypeManagerInterface::class);
  $this->entityFieldManager = $this
    ->createMock(EntityFieldManagerInterface::class);
  $this->entityRepository = $this
    ->createMock(EntityRepositoryInterface::class);
  $this->formatterPluginManager = $this
    ->getMockBuilder('Drupal\\Core\\Field\\FormatterPluginManager')
    ->disableOriginalConstructor()
    ->getMock();
  $this->fieldTypePluginManager = $this
    ->createMock('Drupal\\Core\\Field\\FieldTypePluginManagerInterface');
  $this->fieldTypePluginManager
    ->expects($this
    ->any())
    ->method('getDefaultStorageSettings')
    ->willReturn([]);
  $this->fieldTypePluginManager
    ->expects($this
    ->any())
    ->method('getDefaultFieldSettings')
    ->willReturn([]);
  $this->languageManager = $this
    ->createMock('Drupal\\Core\\Language\\LanguageManagerInterface');
  $this->renderer = $this
    ->createMock('Drupal\\Core\\Render\\RendererInterface');
  $this
    ->setupExecutableAndView();
  $this
    ->setupViewsData();
  $this->display = $this
    ->getMockBuilder('Drupal\\views\\Plugin\\views\\display\\DisplayPluginBase')
    ->disableOriginalConstructor()
    ->getMock();
  $this->container = new ContainerBuilder();
  $this->container
    ->set('plugin.manager.field.field_type', $this->fieldTypePluginManager);
  \Drupal::setContainer($this->container);
}