You are here

protected function NestedFormTest::setUp in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/field/tests/src/Functional/NestedFormTest.php \Drupal\Tests\field\Functional\NestedFormTest::setUp()

Overrides BrowserTestBase::setUp

File

core/modules/field/tests/src/Functional/NestedFormTest.php, line 28

Class

NestedFormTest
Tests field elements in nested forms.

Namespace

Drupal\Tests\field\Functional

Code

protected function setUp() : void {
  parent::setUp();
  $web_user = $this
    ->drupalCreateUser([
    'view test entity',
    'administer entity_test content',
  ]);
  $this
    ->drupalLogin($web_user);
  $this->fieldStorageSingle = [
    'field_name' => 'field_single',
    'entity_type' => 'entity_test',
    'type' => 'test_field',
  ];
  $this->fieldStorageUnlimited = [
    'field_name' => 'field_unlimited',
    'entity_type' => 'entity_test',
    'type' => 'test_field',
    'cardinality' => FieldStorageDefinitionInterface::CARDINALITY_UNLIMITED,
  ];
  $this->field = [
    'entity_type' => 'entity_test',
    'bundle' => 'entity_test',
    'label' => $this
      ->randomMachineName() . '_label',
    'description' => '[site:name]_description',
    'weight' => mt_rand(0, 127),
    'settings' => [
      'test_field_setting' => $this
        ->randomMachineName(),
    ],
  ];
}