function RevisionRevertFormTest::getLogs

Same name in other branches
  1. 10 core/tests/Drupal/FunctionalTests/Entity/RevisionRevertFormTest.php \Drupal\FunctionalTests\Entity\RevisionRevertFormTest::getLogs()

Loads watchdog entries by channel.

Parameters

string $channel: The logger channel.

Return value

string[] Watchdog entries.

1 call to RevisionRevertFormTest::getLogs()
RevisionRevertFormTest::testSubmitForm in core/tests/Drupal/FunctionalTests/Entity/RevisionRevertFormTest.php
Tests revision revert, and expected response after revert.

File

core/tests/Drupal/FunctionalTests/Entity/RevisionRevertFormTest.php, line 349

Class

RevisionRevertFormTest
Tests reverting a revision with revision revert form.

Namespace

Drupal\FunctionalTests\Entity

Code

protected function getLogs(string $channel) : array {
    $logs = \Drupal::database()->select('watchdog')
        ->fields('watchdog')
        ->condition('type', $channel)
        ->execute()
        ->fetchAll();
    return array_map(function (object $log) {
        return (string) new FormattableMarkup($log->message, unserialize($log->variables));
    }, $logs);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.