You are here

public function DbLogTest::testDbLog in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/dblog/tests/src/Functional/DbLogTest.php \Drupal\Tests\dblog\Functional\DbLogTest::testDbLog()
  2. 10 core/modules/dblog/tests/src/Functional/DbLogTest.php \Drupal\Tests\dblog\Functional\DbLogTest::testDbLog()

Tests Database Logging module functionality through interfaces.

First logs in users, then creates database log events, and finally tests Database Logging module functionality through both the admin and user interfaces.

File

core/modules/dblog/tests/src/Functional/DbLogTest.php, line 82

Class

DbLogTest
Generate events and verify dblog entries; verify user access to log reports based on permissions.

Namespace

Drupal\Tests\dblog\Functional

Code

public function testDbLog() {

  // Log in the admin user.
  $this
    ->drupalLogin($this->adminUser);
  $row_limit = 100;
  $this
    ->verifyRowLimit($row_limit);
  $this
    ->verifyEvents();
  $this
    ->verifyReports();
  $this
    ->verifyBreadcrumbs();
  $this
    ->verifyLinkEscaping();

  // Verify the overview table sorting.
  $orders = [
    'Date',
    'Type',
    'User',
  ];
  $sorts = [
    'asc',
    'desc',
  ];
  foreach ($orders as $order) {
    foreach ($sorts as $sort) {
      $this
        ->verifySort($sort, $order);
    }
  }

  // Log in the regular user.
  $this
    ->drupalLogin($this->webUser);
  $this
    ->verifyReports(403);
}