diff --git a/core/modules/dblog/src/Controller/DbLogController.php b/core/modules/dblog/src/Controller/DbLogController.php index a11fcb8e339e0631b652d48cdb6612d6ad41c924..89e5dc2b9734105d28027b8264dfab291cdc8f37 100644 --- a/core/modules/dblog/src/Controller/DbLogController.php +++ b/core/modules/dblog/src/Controller/DbLogController.php @@ -140,7 +140,7 @@ public function overview() { $this->t('Message'), array( 'data' => $this->t('User'), - 'field' => 'u.name', + 'field' => 'ufd.name', 'class' => array(RESPONSIVE_PRIORITY_MEDIUM)), array( 'data' => $this->t('Operations'), @@ -160,6 +160,7 @@ public function overview() { 'variables', 'link', )); + $query->leftJoin('users_field_data', 'ufd', 'w.uid = ufd.uid'); if (!empty($filter['where'])) { $query->where($filter['where'], $filter['args']); diff --git a/core/modules/dblog/src/Tests/DbLogTest.php b/core/modules/dblog/src/Tests/DbLogTest.php index 4dc37e4bf76353a5a33d7662247e1c9618faaa11..2ef242d32b45eb237ed2415ac1fcc07f63ffa9d2 100644 --- a/core/modules/dblog/src/Tests/DbLogTest.php +++ b/core/modules/dblog/src/Tests/DbLogTest.php @@ -65,6 +65,14 @@ function testDbLog() { $this->verifyEvents(); $this->verifyReports(); $this->verifyBreadcrumbs(); + // Verify the overview table sorting. + $orders = array('Date', 'Type', 'User'); + $sorts = array('asc', 'desc'); + foreach ($orders as $order) { + foreach ($sorts as $sort) { + $this->verifySort($sort, $order); + } + } // Login the regular user. $this->drupalLogin($this->any_user); @@ -217,6 +225,20 @@ private function verifyEvents() { // set to zero. } + /** + * Verifies the sorting functionality of the database logging reports table. + * + * @param string $sort + * The sort direction. + * @param string $order + * The order by which the table should be sorted. + */ + public function verifySort($sort = 'asc', $order = 'Date') { + $this->drupalGet('admin/reports/dblog', array('query' => array('sort' => $sort, 'order' => $order))); + $this->assertResponse(200); + $this->assertText(t('Recent log messages'), 'DBLog report was displayed correctly and sorting went fine.'); + } + /** * Generates and then verifies some user events. */