Commit f208a930 authored by catch's avatar catch

Issue #2985701 by longwave, dagmar, catch: Followup: Move...

Issue #2985701 by longwave, dagmar, catch: Followup: Move DbLogTest::generateLogEntries() into a Trait

(cherry picked from commit 7cb2fe80)
parent 90779e26
......@@ -3,6 +3,7 @@
namespace Drupal\Tests\dblog\Functional;
use Drupal\Core\Logger\RfcLogLevel;
use Drupal\Core\Session\AnonymousUserSession;
/**
* Provides methods to generate log entries.
......@@ -37,6 +38,8 @@ trait FakeLogEntries {
private function generateLogEntries($count, $options = []) {
global $base_root;
$user = !empty($this->adminUser) ? $this->adminUser : new AnonymousUserSession();
// Prepare the fields to be logged.
$log = $options + [
'channel' => 'custom',
......@@ -44,8 +47,8 @@ private function generateLogEntries($count, $options = []) {
'variables' => [],
'severity' => RfcLogLevel::NOTICE,
'link' => NULL,
'user' => $this->adminUser,
'uid' => $this->adminUser->id(),
'user' => $user,
'uid' => $user->id(),
'request_uri' => $base_root . \Drupal::request()->getRequestUri(),
'referer' => \Drupal::request()->server->get('HTTP_REFERER'),
'ip' => '127.0.0.1',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment