function DbLogTest::assertLogMessage

Same name in other branches
  1. 9 core/modules/dblog/tests/src/Functional/DbLogTest.php \Drupal\Tests\dblog\Functional\DbLogTest::assertLogMessage()
  2. 10 core/modules/dblog/tests/src/Functional/DbLogTest.php \Drupal\Tests\dblog\Functional\DbLogTest::assertLogMessage()
  3. 11.x core/modules/dblog/tests/src/Functional/DbLogTest.php \Drupal\Tests\dblog\Functional\DbLogTest::assertLogMessage()

Confirms that a log message appears on the database log overview screen.

This function should only be used for the admin/reports/dblog page, because it checks for the message link text truncated to 56 characters. Other log pages have no detail links so they contain the full message text.

Parameters

string $log_message: The database log message to check.

string $message: The message to pass to simpletest.

2 calls to DbLogTest::assertLogMessage()
DbLogTest::doNode in core/modules/dblog/tests/src/Functional/DbLogTest.php
Generates and then verifies some node events.
DbLogTest::doUser in core/modules/dblog/tests/src/Functional/DbLogTest.php
Generates and then verifies some user events.

File

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

Class

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

Namespace

Drupal\Tests\dblog\Functional

Code

protected function assertLogMessage($log_message, $message) {
    $message_text = Unicode::truncate(Html::decodeEntities(strip_tags($log_message)), 56, TRUE, TRUE);
    $this->assertSession()
        ->linkExists($message_text, 0, $message);
}

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