class DbLogViewsTest in Drupal 10
Same name and namespace in other branches
- 8 core/modules/dblog/tests/src/Functional/DbLogViewsTest.php \Drupal\Tests\dblog\Functional\DbLogViewsTest
- 9 core/modules/dblog/tests/src/Functional/DbLogViewsTest.php \Drupal\Tests\dblog\Functional\DbLogViewsTest
Generate events and verify dblog entries; verify user access to log reports based on permissions. Using the dblog UI generated by a View.
@group dblog
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\dblog\Functional\DbLogTest uses FakeLogEntries, AssertBreadcrumbTrait
- class \Drupal\Tests\dblog\Functional\DbLogViewsTest
- class \Drupal\Tests\dblog\Functional\DbLogTest uses FakeLogEntries, AssertBreadcrumbTrait
Expanded class hierarchy of DbLogViewsTest
See also
Drupal\dblog\Tests\DbLogTest
File
- core/
modules/ dblog/ tests/ src/ Functional/ DbLogViewsTest.php, line 15
Namespace
Drupal\Tests\dblog\FunctionalView source
class DbLogViewsTest extends DbLogTest {
/**
* Modules to enable.
*
* @var array
*/
protected static $modules = [
'dblog',
'node',
'forum',
'help',
'block',
'views',
];
/**
* {@inheritdoc}
*/
protected $defaultTheme = 'stark';
/**
* {@inheritdoc}
*/
protected function getLogsEntriesTable() {
return $this
->xpath('.//div[contains(@class, "views-element-container")]//table/tbody/tr');
}
/**
* {@inheritdoc}
*/
protected function filterLogsEntries($type = NULL, $severity = NULL) {
$query = [];
if (isset($type)) {
$query['type[]'] = $type;
}
if (isset($severity)) {
$query['severity[]'] = $severity;
}
$this
->drupalGet('admin/reports/dblog', [
'query' => $query,
]);
}
/**
* Tests the empty text for the watchdog view is not using an input format.
*/
public function testEmptyText() {
$view = Views::getView('watchdog');
$data = $view->storage
->toArray();
$area = $data['display']['default']['display_options']['empty']['area'];
$this
->assertEquals('text_custom', $area['plugin_id']);
$this
->assertEquals('area_text_custom', $area['field']);
$this
->assertEquals('No log messages available.', $area['content']);
}
}