You are here

protected function AddAnotherItemButtonTest::setUp in Custom add another 8

Overrides BrowserTestBase::setUp

File

src/Tests/AddAnotherItemButtonTest.php, line 50

Class

AddAnotherItemButtonTest
Test case for 'Add another item' button label alter.

Namespace

Drupal\custom_add_another\Tests

Code

protected function setUp() {
  parent::setUp();
  $web_user = $this
    ->drupalCreateUser([
    'view test entity',
    'administer entity_test content',
  ]);
  $this
    ->drupalLogin($web_user);
  $this->entityTypeManager = $this->container
    ->get('entity_type.manager');
  $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(),
    ],
  ];
}