function ManageDisplayTest::testNoFieldsDisplayOverview

Same name in other branches
  1. 8.9.x core/modules/field_ui/tests/src/Functional/ManageDisplayTest.php \Drupal\Tests\field_ui\Functional\ManageDisplayTest::testNoFieldsDisplayOverview()
  2. 10 core/modules/field_ui/tests/src/Functional/ManageDisplayTest.php \Drupal\Tests\field_ui\Functional\ManageDisplayTest::testNoFieldsDisplayOverview()
  3. 11.x core/modules/field_ui/tests/src/Functional/ManageDisplayTest.php \Drupal\Tests\field_ui\Functional\ManageDisplayTest::testNoFieldsDisplayOverview()

Tests that a message is shown when there are no fields.

File

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

Class

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

Namespace

Drupal\Tests\field_ui\Functional

Code

public function testNoFieldsDisplayOverview() {
    // Create a fresh content type without any fields.
    NodeType::create([
        'type' => 'no_fields',
        'name' => 'No fields',
    ])->save();
    $this->drupalGet('admin/structure/types/manage/no_fields/display');
    $this->assertSession()
        ->pageTextContains("There are no fields yet added. You can add new fields on the Manage fields page.");
    $this->assertSession()
        ->linkByHrefExists(Url::fromRoute('entity.node.field_ui_fields', [
        'node_type' => 'no_fields',
    ])->toString());
}

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