You are here

protected function DbLogTest::assertLogMessage in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/dblog/tests/src/Functional/DbLogTest.php \Drupal\Tests\dblog\Functional\DbLogTest::assertLogMessage()
  2. 9 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.

@internal

Parameters

string $log_message: The database log message to check.

string $message: A message to display if the assertion fails.

File

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

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(string $log_message, string $message) : void {
  $message_text = Unicode::truncate($log_message, 56, TRUE, TRUE);
  $this
    ->assertSession()
    ->linkExists($message_text, 0, $message);
}