class ReportFieldsTest in Drupal 10
Same name and namespace in other branches
- 8 core/modules/views_ui/tests/src/Functional/ReportFieldsTest.php \Drupal\Tests\views_ui\Functional\ReportFieldsTest
- 9 core/modules/views_ui/tests/src/Functional/ReportFieldsTest.php \Drupal\Tests\views_ui\Functional\ReportFieldsTest
Tests the Views fields report page.
@group views_ui
Hierarchy
- class \Drupal\Tests\BrowserTestBase extends \PHPUnit\Framework\TestCase uses \Drupal\Tests\PhpUnitCompatibilityTrait, \Symfony\Bridge\PhpUnit\ExpectDeprecationTrait, FunctionalTestSetupTrait, TestSetupTrait, BlockCreationTrait, ConfigTestTrait, ExtensionListTestTrait, ContentTypeCreationTrait, NodeCreationTrait, RandomGeneratorTrait, TestRequirementsTrait, PhpUnitWarnings, UiHelperTrait, UserCreationTrait, XdebugRequestTrait
- class \Drupal\Tests\views\Functional\ViewTestBase uses ViewResultAssertionTrait
- class \Drupal\Tests\views_ui\Functional\UITestBase
- class \Drupal\Tests\views_ui\Functional\ReportFieldsTest
- class \Drupal\Tests\views_ui\Functional\UITestBase
- class \Drupal\Tests\views\Functional\ViewTestBase uses ViewResultAssertionTrait
Expanded class hierarchy of ReportFieldsTest
File
- core/
modules/ views_ui/ tests/ src/ Functional/ ReportFieldsTest.php, line 13
Namespace
Drupal\Tests\views_ui\FunctionalView source
class ReportFieldsTest extends UITestBase {
/**
* {@inheritdoc}
*/
public static $testViews = [
'test_field_field_test',
];
/**
* {@inheritdoc}
*/
protected $defaultTheme = 'stark';
/**
* {@inheritdoc}
*/
protected static $modules = [
'entity_test',
];
/**
* Tests the Views fields report page.
*/
public function testReportFields() {
$this
->drupalGet('admin/reports/fields/views-fields');
$this
->assertSession()
->pageTextContains('Used in views');
$this
->assertSession()
->pageTextContains('No fields have been used in views yet.');
// 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();
// Assert that the newly created field appears in the overview.
$this
->drupalGet('admin/reports/fields/views-fields');
$this
->assertSession()
->responseContains('<td>field_test</td>');
$this
->assertSession()
->responseContains('>test_field_field_test</a>');
$this
->assertSession()
->pageTextContains('Used in views');
}
}