You are here

public function DbLogTest::testSameTimestampEntries in Drupal 8

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

Test sorting for entries with the same timestamp.

File

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

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($entries[0]['message'], 'Third Entry #0');
  $this
    ->assertEquals($entries[1]['message'], 'Second Entry #0');
  $this
    ->assertEquals($entries[2]['message'], 'First Entry #0');
}