You are here

protected function PatchInfoTestTrait::assertNoWatchdogMessage in PatchInfo 8.2

Asserts that a watchdog message does not exist.

Parameters

string $type: Message type.

int $severity: Message severity.

string $watchdog_message: Message to assert. Do not translate messages: use strtr() to embed variables in the message text, not t().

string $message: (optional) A message to display with the assertion. Do not translate messages: use strtr() to embed variables in the message text, not t(). If left blank, a default message will be displayed.

Return value

bool TRUE if the assertion succeeded, FALSE otherwise.

See also

\Drupal\Core\Logger\RfcLogLevel

File

tests/src/Traits/PatchInfoTestTrait.php, line 183

Class

PatchInfoTestTrait
Provides common methods for functional tests of PatchInfo module.

Namespace

Drupal\Tests\patchinfo\Traits

Code

protected function assertNoWatchdogMessage($type, $severity, $watchdog_message, $message = NULL) {
  $message = $message ? $message : new FormattableMarkup('Message count for message "@message" of type "@type" with severity "@severity" is 0.', [
    '@message' => $watchdog_message,
    '@type' => $type,
    '@severity' => $severity,
  ]);
  $watchdog_message_count = $this
    ->getWatchdogMessageCount($type, $severity, $watchdog_message);
  return $this
    ->assertTrue($watchdog_message_count === 0, $message);
}