DbLogViewsTest.php in Drupal 9
File
core/modules/dblog/tests/src/Functional/DbLogViewsTest.php
View source
<?php
namespace Drupal\Tests\dblog\Functional;
use Drupal\views\Views;
class DbLogViewsTest extends DbLogTest {
protected static $modules = [
'dblog',
'node',
'forum',
'help',
'block',
'views',
];
protected $defaultTheme = 'classy';
protected function getLogsEntriesTable() {
return $this
->xpath('.//table[contains(@class, "views-view-table")]/tbody/tr');
}
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,
]);
}
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']);
}
}
Classes
Name |
Description |
DbLogViewsTest |
Generate events and verify dblog entries; verify user access to log reports
based on permissions. Using the dblog UI generated by a View. |