protected function 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 drupal/core/modules/dblog/lib/Drupal/dblog/Tests/DBLogTest.php
Generates and then verifies some node events.
DBLogTest::doUser in drupal/core/modules/dblog/lib/Drupal/dblog/Tests/DBLogTest.php
Generates and then verifies some user events.

File

drupal/core/modules/dblog/lib/Drupal/dblog/Tests/DBLogTest.php, line 639
Definition of Drupal\dblog\Tests\DBLogTest.

Class

DBLogTest
Tests logging messages to the database.

Namespace

Drupal\dblog\Tests

Code

protected function assertLogMessage($log_message, $message) {
  $message_text = truncate_utf8(filter_xss($log_message, array()), 56, TRUE, TRUE);

  // After filter_xss(), HTML entities should be converted to their character
  // equivalents because assertLink() uses this string in xpath() to query the
  // Document Object Model (DOM).
  $this
    ->assertLink(html_entity_decode($message_text), 0, $message);
}