You are here

public function ManageDisplayTest::testNoFieldsDisplayOverview in Drupal 9

Same name and namespace in other branches
  1. 8 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 206

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());
}