function ManageDisplayTest::setUp

Same name in this branch
  1. 11.x core/modules/field_ui/tests/src/FunctionalJavascript/ManageDisplayTest.php \Drupal\Tests\field_ui\FunctionalJavascript\ManageDisplayTest::setUp()
Same name in other branches
  1. 9 core/modules/field_ui/tests/src/FunctionalJavascript/ManageDisplayTest.php \Drupal\Tests\field_ui\FunctionalJavascript\ManageDisplayTest::setUp()
  2. 9 core/modules/field_ui/tests/src/Functional/ManageDisplayTest.php \Drupal\Tests\field_ui\Functional\ManageDisplayTest::setUp()
  3. 8.9.x core/modules/field_ui/tests/src/FunctionalJavascript/ManageDisplayTest.php \Drupal\Tests\field_ui\FunctionalJavascript\ManageDisplayTest::setUp()
  4. 8.9.x core/modules/field_ui/tests/src/Functional/ManageDisplayTest.php \Drupal\Tests\field_ui\Functional\ManageDisplayTest::setUp()
  5. 10 core/modules/field_ui/tests/src/FunctionalJavascript/ManageDisplayTest.php \Drupal\Tests\field_ui\FunctionalJavascript\ManageDisplayTest::setUp()
  6. 10 core/modules/field_ui/tests/src/Functional/ManageDisplayTest.php \Drupal\Tests\field_ui\Functional\ManageDisplayTest::setUp()

Overrides BrowserTestBase::setUp

File

core/modules/field_ui/tests/src/Functional/ManageDisplayTest.php, line 58

Class

ManageDisplayTest
Tests the Field UI "Manage display" and "Manage form display" screens.

Namespace

Drupal\Tests\field_ui\Functional

Code

protected function setUp() : void {
    parent::setUp();
    $this->drupalPlaceBlock('system_breadcrumb_block');
    $this->drupalPlaceBlock('local_tasks_block');
    // Create a test user.
    $admin_user = $this->drupalCreateUser([
        'access content',
        'administer content types',
        'administer display modes',
        'administer node fields',
        'administer node form display',
        'administer node display',
        'administer taxonomy',
        'administer taxonomy_term fields',
        'administer taxonomy_term form display',
        'administer taxonomy_term display',
        'administer users',
        'administer account settings',
        'administer user display',
        'bypass node access',
    ]);
    $this->drupalLogin($admin_user);
    // Create content type, with underscores.
    $type_name = $this->randomMachineName(8) . '_test';
    $type = $this->drupalCreateContentType([
        'name' => $type_name,
        'type' => $type_name,
    ]);
    $this->type = $type->id();
    // Create a default vocabulary.
    $vocabulary = Vocabulary::create([
        'name' => $this->randomMachineName(),
        'description' => $this->randomMachineName(),
        'vid' => $this->randomMachineName(),
        'langcode' => LanguageInterface::LANGCODE_NOT_SPECIFIED,
        'help' => '',
        'nodes' => [
            'article' => 'article',
        ],
        'weight' => mt_rand(0, 10),
    ]);
    $vocabulary->save();
    $this->vocabulary = $vocabulary->id();
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.