You are here

protected function DateRecurFieldItemDefaultValuesTest::setUp in Recurring Dates Field 8.2

Same name and namespace in other branches
  1. 3.x tests/src/Kernel/DateRecurFieldItemDefaultValuesTest.php \Drupal\Tests\date_recur\Kernel\DateRecurFieldItemDefaultValuesTest::setUp()
  2. 3.0.x tests/src/Kernel/DateRecurFieldItemDefaultValuesTest.php \Drupal\Tests\date_recur\Kernel\DateRecurFieldItemDefaultValuesTest::setUp()
  3. 3.1.x tests/src/Kernel/DateRecurFieldItemDefaultValuesTest.php \Drupal\Tests\date_recur\Kernel\DateRecurFieldItemDefaultValuesTest::setUp()

Overrides KernelTestBase::setUp

File

tests/src/Kernel/DateRecurFieldItemDefaultValuesTest.php, line 50

Class

DateRecurFieldItemDefaultValuesTest
Tests date_recur field with default values configured at the instance level.

Namespace

Drupal\Tests\date_recur\Kernel

Code

protected function setUp() {
  parent::setUp();
  $this
    ->installEntitySchema('dr_entity_test');
  $this
    ->installConfig([
    'system',
  ]);

  /** @var \Drupal\Core\Entity\EntityFieldManagerInterface $entityFieldManager */
  $entityFieldManager = \Drupal::service('entity_field.manager');
  $baseFields = $entityFieldManager
    ->getBaseFieldDefinitions('dr_entity_test');
  $this->baseFieldOverride = BaseFieldOverride::createFromBaseFieldDefinition($baseFields['dr'], 'dr_entity_test');
  $user = User::create([
    'uid' => 2,
    'timezone' => 'Asia/Singapore',
  ]);
  $this->container
    ->get('current_user')
    ->setAccount($user);
}