function FieldTest::setUp

Same name in this branch
  1. main 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. 11.x core/modules/views/tests/src/Unit/Plugin/field/FieldTest.php \Drupal\Tests\views\Unit\Plugin\field\FieldTest::setUp()
  2. 11.x core/modules/views/tests/src/FunctionalJavascript/Plugin/views/Handler/FieldTest.php \Drupal\Tests\views\FunctionalJavascript\Plugin\views\Handler\FieldTest::setUp()
  3. 10 core/modules/views/tests/src/Unit/Plugin/field/FieldTest.php \Drupal\Tests\views\Unit\Plugin\field\FieldTest::setUp()
  4. 10 core/modules/views/tests/src/FunctionalJavascript/Plugin/views/Handler/FieldTest.php \Drupal\Tests\views\FunctionalJavascript\Plugin\views\Handler\FieldTest::setUp()
  5. 9 core/modules/views/tests/src/Unit/Plugin/field/FieldTest.php \Drupal\Tests\views\Unit\Plugin\field\FieldTest::setUp()
  6. 9 core/modules/views/tests/src/FunctionalJavascript/Plugin/views/Handler/FieldTest.php \Drupal\Tests\views\FunctionalJavascript\Plugin\views\Handler\FieldTest::setUp()
  7. 9 core/modules/quickedit/tests/src/FunctionalJavascript/FieldTest.php \Drupal\Tests\quickedit\FunctionalJavascript\FieldTest::setUp()
  8. 8.9.x core/modules/views/tests/src/Unit/Plugin/field/FieldTest.php \Drupal\Tests\views\Unit\Plugin\field\FieldTest::setUp()
  9. 8.9.x core/modules/views/tests/src/FunctionalJavascript/Plugin/views/Handler/FieldTest.php \Drupal\Tests\views\FunctionalJavascript\Plugin\views\Handler\FieldTest::setUp()
  10. 8.9.x core/modules/quickedit/tests/src/FunctionalJavascript/FieldTest.php \Drupal\Tests\quickedit\FunctionalJavascript\FieldTest::setUp()

Overrides UnitTestCase::setUp

File

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

Class

FieldTest
Tests Drupal\views\Plugin\views\field\EntityField.

Namespace

Drupal\Tests\views\Unit\Plugin\field

Code

protected function setUp() : void {
  parent::setUp();
  $this->entityTypeManager = $this->createStub(EntityTypeManagerInterface::class);
  $this->entityFieldManager = $this->createStub(EntityFieldManagerInterface::class);
  $this->entityTypeBundleInfo = $this->createStub(EntityTypeBundleInfoInterface::class);
  $this->entityRepository = $this->createStub(EntityRepositoryInterface::class);
  $this->formatterPluginManager = $this->createStub(FormatterPluginManager::class);
  $this->fieldTypePluginManager = $this->createStub(FieldTypePluginManagerInterface::class);
  $this->fieldTypePluginManager
    ->method('getDefaultStorageSettings')
    ->willReturn([]);
  $this->fieldTypePluginManager
    ->method('getDefaultFieldSettings')
    ->willReturn([]);
  $this->languageManager = $this->createStub(LanguageManagerInterface::class);
  $this->renderer = $this->createStub(RendererInterface::class);
  $this->setupExecutableAndView();
  $this->setupViewsData();
  $this->display = $this->createStub(DisplayPluginBase::class);
  $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.