class DbLogViewsTest

Verifies user access to log reports based on permissions.

@group dblog

Hierarchy

Expanded class hierarchy of DbLogViewsTest

See also

Drupal\dblog\Tests\DbLogTest

File

core/modules/dblog/tests/src/Functional/DbLogViewsTest.php, line 16

Namespace

Drupal\Tests\dblog\Functional
View source
class DbLogViewsTest extends DbLogTest {
  
  /**
   * {@inheritdoc}
   */
  protected static $modules = [
    'dblog',
    'node',
    '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() : void {
    $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']);
  }

}

Members

Title Sort descending Modifiers Object type Summary Overriden Title
DbLogTest::$adminUser protected property A user with some relevant administrative permissions.
DbLogTest::$webUser protected property A user without any permissions.
DbLogTest::assertLogMessage protected function Confirms that a log message appears on the database log overview screen.
DbLogTest::clearLogsEntries protected function Clear the entry logs by clicking on 'Clear log messages' button.
DbLogTest::doNode private function Generates and then verifies some node events.
DbLogTest::doUser private function Generates and then verifies some user events.
DbLogTest::getLogEntries protected function Gets the database log event information from the browser page.
DbLogTest::getSeverityConstant protected function Gets the watchdog severity constant corresponding to the CSS class.
DbLogTest::getTypeCount protected function Gets the count of database log entries by database log event type.
DbLogTest::setUp protected function
DbLogTest::test403LogEventPage protected function Tests that a 403 event is logged with the exception triggering it.
DbLogTest::testBacktrace public function Tests that the details page displays correctly backtrace.
DbLogTest::testDbLog public function Tests Database Logging module functionality through interfaces.
DbLogTest::testDBLogAddAndClear public function Tests the addition and clearing of log events through the admin interface.
DbLogTest::testFilter public function Tests the database log filter functionality at admin/reports/dblog.
DbLogTest::testLogEventNotFoundPage protected function Tests not-existing log event page.
DbLogTest::testLogEventPage public function Tests individual log event page.
DbLogTest::testLogEventPageWithMissingInfo protected function Tests individual log event page with missing log attributes.
DbLogTest::testMessageParsing protected function Test that twig errors are displayed correctly.
DbLogTest::testOnError public function Tests that the details page displays the backtrace for a logged \Throwable.
DbLogTest::testOverviewLinks protected function Make sure HTML tags are filtered out in the log overview links.
DbLogTest::testSameTimestampEntries public function Tests sorting for entries with the same timestamp.
DbLogTest::testTemporaryUser public function Tests that the details page displays correctly for a temporary user.
DbLogTest::verifyBreadcrumbs private function Generates and then verifies breadcrumbs.
DbLogTest::verifyEvents private function Generates and then verifies various types of events.
DbLogTest::verifyLinkEscaping private function Tests link escaping in the operation row of a database log detail page.
DbLogTest::verifyReports private function Confirms that database log reports are displayed at the correct paths.
DbLogTest::verifyRowLimit private function Verifies setting of the database log row limit.
DbLogTest::verifySort protected function Verifies the sorting functionality of the database logging reports table.
DbLogViewsTest::$defaultTheme protected property Overrides DbLogTest::$defaultTheme
DbLogViewsTest::$modules protected static property Overrides DbLogTest::$modules
DbLogViewsTest::filterLogsEntries protected function Filters the logs according to the specific severity and log entry type. Overrides DbLogTest::filterLogsEntries
DbLogViewsTest::getLogsEntriesTable protected function Find the Logs table in the DOM. Overrides DbLogTest::getLogsEntriesTable
DbLogViewsTest::testEmptyText public function Tests the empty text for the watchdog view is not using an input format.
FakeLogEntries::generateLogEntries private function Generates a number of random database log events.

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.