You are here

public function ManageDisplayTest::testNoFieldsDisplayOverview in Drupal 8

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

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
    ->assertRaw(t('There are no fields yet added. You can add new fields on the <a href=":link">Manage fields</a> page.', [
    ':link' => Url::fromRoute('entity.node.field_ui_fields', [
      'node_type' => 'no_fields',
    ])
      ->toString(),
  ]));
}