You are here

protected function FieldValueTest::setUp in Twig Field Value 8

Same name in this branch
  1. 8 tests/src/Kernel/FieldValueTest.php \Drupal\Tests\twig_field_value\Kernel\FieldValueTest::setUp()
  2. 8 tests/src/Unit/FieldValue/FieldValueTest.php \Drupal\Tests\twig_field_value\Unit\FieldValue\FieldValueTest::setUp()
Same name and namespace in other branches
  1. 2.0.x tests/src/Kernel/FieldValueTest.php \Drupal\Tests\twig_field_value\Kernel\FieldValueTest::setUp()

Overrides EntityKernelTestBase::setUp

File

tests/src/Kernel/FieldValueTest.php, line 27

Class

FieldValueTest
@coversDefaultClass \Drupal\twig_field_value\Twig\Extension\FieldValueExtension @group twig_field_value

Namespace

Drupal\Tests\twig_field_value\Kernel

Code

protected function setUp() {
  parent::setUp();
  $fieldStorage = FieldStorageConfig::create([
    'field_name' => 'field_reference',
    'type' => 'entity_reference',
    'entity_type' => 'entity_test',
    'cardinality' => FieldStorageConfigInterface::CARDINALITY_UNLIMITED,
    'settings' => [
      'target_type' => 'entity_test',
    ],
  ]);
  $fieldStorage
    ->save();
  $fieldConfig = FieldConfig::create([
    'field_storage' => $fieldStorage,
    'bundle' => 'entity_test',
  ]);
  $fieldConfig
    ->save();
  $current_user = $this->container
    ->get('current_user');
  $current_user
    ->setAccount($this
    ->createUser([], [
    'view test entity',
  ]));
}