function FileSelectionTest::setUp

Overrides KernelTestBase::setUp

File

core/modules/file/tests/src/Kernel/Plugin/EntityReference/FileSelectionTest.php, line 41

Class

FileSelectionTest
Tests file selection plugin.

Namespace

Drupal\Tests\file\Kernel\Plugin\EntityReference

Code

protected function setUp() : void {
  parent::setUp();
  $this->installEntitySchema('entity_test');
  $this->installEntitySchema('file');
  $this->installEntitySchema('user');
  $field_name = $this->randomMachineName();
  $this->createEntityReferenceField('entity_test', 'entity_test', $field_name, $this->randomString(), 'file');
  $field_config = FieldConfig::loadByName('entity_test', 'entity_test', $field_name);
  $this->selectionHandler = $this->container
    ->get('plugin.manager.entity_reference_selection')
    ->getSelectionHandler($field_config);
}

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