You are here

protected function ScheduledTransitionTest::getLogs in Scheduled Transitions 8

Same name and namespace in other branches
  1. 2.x tests/src/Kernel/ScheduledTransitionTest.php \Drupal\Tests\scheduled_transitions\Kernel\ScheduledTransitionTest::getLogs()

Gets logs from buffer and cleans out buffer.

Reconstructs logs into plain strings.

Parameters

array|null $logBuffer: A log buffer from getLogBuffer, or provide an existing value fetched from getLogBuffer. This is a workaround for the logger clearing values on call.

Return value

array Logs from buffer, where values are an array with keys: severity, message.

5 calls to ScheduledTransitionTest::getLogs()
ScheduledTransitionTest::testLogsDeletedState in tests/src/Kernel/ScheduledTransitionTest.php
Test when a default or latest revision use a state that no longer exists.
ScheduledTransitionTest::testScheduledRevision in tests/src/Kernel/ScheduledTransitionTest.php
Tests a scheduled revision.
ScheduledTransitionTest::testScheduledRevisionLatestNonDefault in tests/src/Kernel/ScheduledTransitionTest.php
Tests a scheduled revision.
ScheduledTransitionTest::testScheduledRevisionRecreateDefaultHead in tests/src/Kernel/ScheduledTransitionTest.php
Tests a scheduled revision.
ScheduledTransitionTest::testScheduledRevisionRecreateNonDefaultHead in tests/src/Kernel/ScheduledTransitionTest.php
Tests a scheduled revision.

File

tests/src/Kernel/ScheduledTransitionTest.php, line 726

Class

ScheduledTransitionTest
Tests basic functionality of scheduled_transitions fields.

Namespace

Drupal\Tests\scheduled_transitions\Kernel

Code

protected function getLogs(?array $logBuffer = NULL) : array {
  $logs = array_map(function (array $log) {
    [
      $severity,
      $message,
      $context,
    ] = $log;
    return [
      'severity' => $severity,
      'message' => str_replace(array_keys($context), array_values($context), $message),
    ];
  }, $logBuffer ?? $this
    ->getLogBuffer());
  return array_values($logs);
}