You are here

protected function DbLogTest::assertLogMessage 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::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 806

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($log_message, 56, TRUE, TRUE);
  $this
    ->assertSession()
    ->linkExists($message_text, 0, $message);
}