You are here

public function LoggerTest::testLogClosure in MongoDB 8.2

Ensure logging from a closure does not fail.

@covers ::enhanceLogEntry

See also

https://www.drupal.org/project/mongodb/issues/3193195

File

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

Class

LoggerTest
Class LoggerTest tests the logging mechanism itself.

Namespace

Drupal\Tests\mongodb_watchdog\Kernel

Code

public function testLogClosure() {
  $logger = $this->container
    ->get(Logger::SERVICE_LOGGER);
  $closure = function () use ($logger) {
    $logger
      ->notice("This fails on PHP below 7.0, and 5.6 needs to be supported for Drupal 8. The alcaeus adapter passes the version check, but does not address this.");
    return 1;
  };
  $this
    ->assertEquals(1, $closure());
}