You are here

protected function FieldRedirectionResultBuilderLinkTest::setUp in Field Redirection 8.2

Overrides KernelTestBase::setUp

File

tests/src/Kernel/FieldRedirectionResultBuilderLinkTest.php, line 45

Class

FieldRedirectionResultBuilderLinkTest
Defines a class for testing field redirection result builder for link fields.

Namespace

Drupal\Tests\field_redirection\Kernel

Code

protected function setUp() {
  parent::setUp();
  $this
    ->installSchema('system', 'sequences');
  $this
    ->installEntitySchema('entity_test');
  $this
    ->installEntitySchema('user');
  $this
    ->installConfig('user');
  $storage = FieldStorageConfig::create([
    'entity_type' => 'entity_test',
    'field_name' => 'field_redirect_link',
    'id' => 'entity_test.field_redirect_link',
    'type' => 'link',
    'cardinality' => FieldStorageDefinitionInterface::CARDINALITY_UNLIMITED,
  ]);
  $storage
    ->save();
  $config = FieldConfig::create([
    'field_name' => 'field_redirect_link',
    'entity_type' => 'entity_test',
    'bundle' => 'entity_test',
    'id' => 'entity_test.entity_test.field_redirect_link',
    'label' => 'Redirect',
  ]);
  $config
    ->save();
  \Drupal::configFactory()
    ->getEditable('system.site')
    ->set('name', 'field-redirection-test')
    ->save();
  \Drupal::state()
    ->set('system.cron_key', '12345678');

  // Create user 1 so our tests don't use it.
  $this
    ->createUser();
}