You are here

protected function TestBase::setUp in Double Field 4.x

Same name in this branch
  1. 4.x tests/src/Functional/TestBase.php \Drupal\Tests\double_field\Functional\TestBase::setUp()
  2. 4.x tests/src/FunctionalJavascript/TestBase.php \Drupal\Tests\double_field\FunctionalJavascript\TestBase::setUp()
Same name and namespace in other branches
  1. 8.3 tests/src/FunctionalJavascript/TestBase.php \Drupal\Tests\double_field\FunctionalJavascript\TestBase::setUp()

Overrides BrowserTestBase::setUp

File

tests/src/FunctionalJavascript/TestBase.php, line 105

Class

TestBase
Base class for Double Field JavaScript tests.

Namespace

Drupal\Tests\double_field\FunctionalJavascript

Code

protected function setUp() : void {
  parent::setUp();
  $this->fieldName = strtolower($this
    ->randomMachineName());
  $this->fieldPrefix = "fields[{$this->fieldName}][settings_edit_form][settings]";
  $this->contentTypeId = $this
    ->drupalCreateContentType([
    'type' => $this
      ->randomMachineName(),
  ])
    ->id();
  $this->contentTypeAdminPath = 'admin/structure/types/manage/' . $this->contentTypeId;
  $this->fieldAdminPath = "{$this->contentTypeAdminPath}/fields/node.{$this->contentTypeId}.{$this->fieldName}}";
  $this->fieldStorageAdminPath = $this->fieldAdminPath . '/storage';
  $this->formDisplayAdminPath = $this->contentTypeAdminPath . '/form-display';
  $this->displayAdminPath = $this->contentTypeAdminPath . '/display';
  $this->nodeAddPath = 'node/add/' . $this->contentTypeId;
  $this->adminUser = $this
    ->drupalCreateUser([
    'administer content types',
    'administer node fields',
    'administer nodes',
    'administer node form display',
    'administer node display',
    "edit any {$this->contentTypeId} content",
    "delete any {$this->contentTypeId} content",
  ]);
  $this
    ->drupalLogin($this->adminUser);
}