function ManageFieldsTest::testFieldCategoryFallbackWithoutDescription

Same name in other branches
  1. 10 core/modules/field_ui/tests/src/Functional/ManageFieldsTest.php \Drupal\Tests\field_ui\Functional\ManageFieldsTest::testFieldCategoryFallbackWithoutDescription()

Ensure field category fallback works for field types without a description.

File

core/modules/field_ui/tests/src/Functional/ManageFieldsTest.php, line 372

Class

ManageFieldsTest
Tests the Manage Display page of a fieldable entity type.

Namespace

Drupal\Tests\field_ui\Functional

Code

public function testFieldCategoryFallbackWithoutDescription() : void {
    $user = $this->drupalCreateUser([
        'administer node fields',
    ]);
    $node_type = $this->drupalCreateContentType();
    $this->drupalLogin($user);
    $this->drupalGet('/admin/structure/types/manage/' . $node_type->id() . '/fields/add-field');
    $field_type = $this->assertSession()
        ->elementExists('xpath', '//label[text()="Test field"]');
    $description_container = $field_type->getParent()
        ->find('css', '.field-option__description');
    $this->assertNotNull($description_container);
    $this->assertEquals('', $description_container->getText());
}

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