3 namespace Drupal\Tests\views_ui\Functional;
5 use Drupal\field\Entity\FieldConfig;
6 use Drupal\field\Entity\FieldStorageConfig;
9 * Tests the Views fields report page.
13 class ReportFieldsTest extends UITestBase {
18 public static $testViews = ['test_field_field_test'];
23 public static $modules = ['entity_test'];
26 * Tests the Views fields report page.
28 public function testReportFields() {
29 $this->drupalGet('admin/reports/fields/views-fields');
30 $this->assertRaw('Used in views', 'Title appears correctly');
31 $this->assertRaw('No fields have been used in views yet.', 'No results message appears correctly.');
33 // Set up the field_test field.
34 $field_storage = FieldStorageConfig::create([
35 'field_name' => 'field_test',
37 'entity_type' => 'entity_test',
39 $field_storage->save();
41 $field = FieldConfig::create([
42 'field_name' => 'field_test',
43 'entity_type' => 'entity_test',
44 'bundle' => 'entity_test',
48 $this->drupalGet('admin/reports/fields/views-fields');
49 // Assert that the newly created field appears in the overview.
50 $this->assertRaw('<td>field_test</td>', 'Field name appears correctly');
51 $this->assertRaw('>test_field_field_test</a>', 'View name appears correctly');
52 $this->assertRaw('Used in views', 'Title appears correctly');