You are here

public function DbLogTest::testSameTimestampEntries 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::testSameTimestampEntries()
  2. 10 core/modules/dblog/tests/src/Functional/DbLogTest.php \Drupal\Tests\dblog\Functional\DbLogTest::testSameTimestampEntries()

Tests sorting for entries with the same timestamp.

File

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

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 testSameTimestampEntries() {
  $this
    ->drupalLogin($this->adminUser);
  $this
    ->generateLogEntries(1, [
    'timestamp' => 1498062000,
    'type' => 'same_time',
    'message' => 'First',
  ]);
  $this
    ->generateLogEntries(1, [
    'timestamp' => 1498062000,
    'type' => 'same_time',
    'message' => 'Second',
  ]);
  $this
    ->generateLogEntries(1, [
    'timestamp' => 1498062000,
    'type' => 'same_time',
    'message' => 'Third',
  ]);
  $this
    ->drupalGet('admin/reports/dblog');
  $entries = $this
    ->getLogEntries();
  $this
    ->assertEquals('Third Entry #0', $entries[0]['message']);
  $this
    ->assertEquals('Second Entry #0', $entries[1]['message']);
  $this
    ->assertEquals('First Entry #0', $entries[2]['message']);
}