You are here

public function ReportFieldsTest::testReportFields in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/views_ui/src/Tests/ReportFieldsTest.php \Drupal\views_ui\Tests\ReportFieldsTest::testReportFields()

Tests the Views fields report page.

File

core/modules/views_ui/src/Tests/ReportFieldsTest.php, line 33
Contains \Drupal\views_ui\Tests\ReportFieldsTest.

Class

ReportFieldsTest
Tests the Views fields report page.

Namespace

Drupal\views_ui\Tests

Code

public function testReportFields() {
  $this
    ->drupalGet('admin/reports/fields/views-fields');
  $this
    ->assertRaw('Used in views', 'Title appears correctly');
  $this
    ->assertRaw('No fields have been used in views yet.', 'No results message appears correctly.');

  // Set up the field_test field.
  $field_storage = FieldStorageConfig::create([
    'field_name' => 'field_test',
    'type' => 'integer',
    'entity_type' => 'entity_test',
  ]);
  $field_storage
    ->save();
  $field = FieldConfig::create([
    'field_name' => 'field_test',
    'entity_type' => 'entity_test',
    'bundle' => 'entity_test',
  ]);
  $field
    ->save();
  $this
    ->drupalGet('admin/reports/fields/views-fields');

  // Assert that the newly created field appears in the overview.
  $this
    ->assertRaw('<td>field_test</td>', 'Field name appears correctly');
  $this
    ->assertRaw('>test_field_field_test</a>', 'View name appears correctly');
  $this
    ->assertRaw('Used in views', 'Title appears correctly');
}