function DbLogTest::testSameTimestampEntries

Same name in other branches
  1. 9 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()
  3. 11.x 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');
}

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