Commit 8b569be7 authored by xjm's avatar xjm
Browse files

Issue #1942682 by zaporylie, deadbeef, jhedstrom, dawehner: Blank detail view...

Issue #1942682 by zaporylie, deadbeef, jhedstrom, dawehner: Blank detail view in dblog for deleted users
parent 046965df
......@@ -242,12 +242,12 @@ public function overview() {
*/
public function eventDetails($event_id) {
$build = array();
if ($dblog = $this->database->query('SELECT w.*, u.name, u.uid FROM {watchdog} w INNER JOIN {users_field_data} u ON w.uid = u.uid WHERE w.wid = :id AND u.default_langcode = 1', array(':id' => $event_id))->fetchObject()) {
if ($dblog = $this->database->query('SELECT w.*, u.uid FROM {watchdog} w LEFT JOIN {users} u ON u.uid = w.uid WHERE w.wid = :id', array(':id' => $event_id))->fetchObject()) {
$severity = RfcLogLevel::getLevels();
$message = $this->formatMessage($dblog);
$username = array(
'#theme' => 'username',
'#account' => $this->userStorage->load($dblog->uid),
'#account' => $this->userStorage->load($dblog->uid ? $dblog->uid : 0),
);
$rows = array(
array(
......
......@@ -698,4 +698,33 @@ protected function assertLogMessage($log_message, $message) {
// string in xpath() to query the Document Object Model (DOM).
$this->assertLink(html_entity_decode($message_text), 0, $message);
}
/**
* Tests that the details page displays correctly for a temporary user.
*/
public function testTemporaryUser() {
// Create a temporary user.
$tempuser = $this->drupalCreateUser();
$tempuser_uid = $tempuser->id();
// Log in as the admin user.
$this->drupalLogin($this->adminUser);
// Generate a single watchdog entry.
$this->generateLogEntries(1, array('user' => $tempuser, 'uid' => $tempuser_uid));
$wid = db_query('SELECT MAX(wid) FROM {watchdog}')->fetchField();
// Check if the full message displays on the details page.
$this->drupalGet('admin/reports/dblog/event/' . $wid);
$this->assertText('Dblog test log message');
// Delete the user.
user_delete($tempuser->id());
$this->drupalGet('user/' . $tempuser_uid);
$this->assertResponse(404);
// Check if the full message displays on the details page.
$this->drupalGet('admin/reports/dblog/event/' . $wid);
$this->assertText('Dblog test log message');
}
}
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