You are here

public function LoggerTest::assertEntry in MongoDB 8.2

Assert that a given entry is present in the watchdog.

Parameters

string $message: The message is present in the collection.

1 call to LoggerTest::assertEntry()
LoggerTest::testWatchdogLimit in modules/mongodb_watchdog/tests/src/Kernel/LoggerTest.php
Test the default and non-default mongodb_watchdog insertion behaviours.

File

modules/mongodb_watchdog/tests/src/Kernel/LoggerTest.php, line 68

Class

LoggerTest
Class LoggerTest tests the logging mechanism itself.

Namespace

Drupal\Tests\mongodb_watchdog\Kernel

Code

public function assertEntry($message) {
  $logged = $this
    ->find($message);
  $this
    ->assertNotNull($logged, (string) $this
    ->t('Event %message is logged', [
    '%message' => $message,
  ]));
  $this
    ->assertTrue(isset($logged['message']) && $logged['message'] == $message, (string) $this
    ->t('Logged message is unchanged'));
}