function RevisionDeleteFormTest::getLogs

Same name in other branches
  1. 11.x core/tests/Drupal/FunctionalTests/Entity/RevisionDeleteFormTest.php \Drupal\FunctionalTests\Entity\RevisionDeleteFormTest::getLogs()

Loads watchdog entries by channel.

Parameters

string $channel: The logger channel.

Return value

string[] Watchdog entries.

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

File

core/tests/Drupal/FunctionalTests/Entity/RevisionDeleteFormTest.php, line 336

Class

RevisionDeleteFormTest
Tests deleting a revision with revision delete form.

Namespace

Drupal\FunctionalTests\Entity

Code

protected function getLogs(string $channel) : array {
    $logs = \Drupal::database()->query("SELECT * FROM {watchdog} WHERE type = :type", [
        ':type' => $channel,
    ])
        ->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.