function FieldTest::setUp

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

Overrides UnitTestCase::setUp

File

core/modules/views/tests/src/Unit/Plugin/field/FieldTest.php, line 87

Class

FieldTest
@coversDefaultClass <a href="/api/drupal/core%21modules%21views%21src%21Plugin%21views%21field%21EntityField.php/class/EntityField/9" title="A field that displays entity field data." class="local">\Drupal\views\Plugin\views\field\EntityField</a> @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);
}

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