diff --git a/core/modules/dblog/src/Controller/DbLogController.php b/core/modules/dblog/src/Controller/DbLogController.php index 9c6da3e..cccd91d 100644 --- a/core/modules/dblog/src/Controller/DbLogController.php +++ b/core/modules/dblog/src/Controller/DbLogController.php @@ -230,7 +230,6 @@ public function overview() { * @return array * If the ID is located in the Database Logging table, a build array in the * format expected by drupal_render(); - * */ public function eventDetails($event_id) { $build = array(); @@ -316,7 +315,7 @@ public function eventDetails($event_id) { */ protected function buildFilterQuery() { if (empty($_SESSION['dblog_overview_filter'])) { - return; + return NULL; } $this->moduleHandler->loadInclude('dblog', 'admin.inc'); @@ -346,7 +345,7 @@ protected function buildFilterQuery() { /** * Formats a database log message. * - * @param stdClass $row + * @param \stdClass $row * The record from the watchdog table. The object properties are: wid, uid, * severity, type, timestamp, message, variables, link, name. * diff --git a/core/modules/dblog/src/Tests/DbLogTest.php b/core/modules/dblog/src/Tests/DbLogTest.php index 03b45ad..0926cc4 100644 --- a/core/modules/dblog/src/Tests/DbLogTest.php +++ b/core/modules/dblog/src/Tests/DbLogTest.php @@ -28,7 +28,7 @@ class DbLogTest extends WebTestBase { * * @var array */ - public static $modules = array('dblog', 'node', 'forum', 'help'); + public static $modules = array('dblog', 'node', 'forum', 'help', 'block'); /** * A user with some relevant administrative permissions. @@ -44,11 +44,19 @@ class DbLogTest extends WebTestBase { */ protected $webUser; + /** + * {@inheritdoc} + */ protected function setUp() { parent::setUp(); + $this->drupalPlaceBlock('system_breadcrumb_block'); // Create users with specific permissions. - $this->adminUser = $this->drupalCreateUser(array('administer site configuration', 'access administration pages', 'access site reports', 'administer users')); + $this->adminUser = $this->drupalCreateUser(array( + 'administer site configuration', + 'access administration pages', + 'access site reports', + 'administer users')); $this->webUser = $this->drupalCreateUser(array()); } @@ -59,7 +67,7 @@ protected function setUp() { * Database Logging module functionality through both the admin and user * interfaces. */ - function testDbLog() { + public function testDbLog() { // Login the admin user. $this->drupalLogin($this->adminUser); @@ -135,7 +143,7 @@ private function verifyCron($row_limit) { private function generateLogEntries($count, $options = array()) { global $base_root; - // Prepare the fields to be logged + // Prepare the fields to be logged. $log = $options + array( 'channel' => 'system', 'message' => 'Dblog test log message', @@ -251,7 +259,7 @@ protected function verifySort($sort = 'asc', $order = 'Date') { } /** - * Test the escaping of links in the operation row of a database log detail + * Tests the escaping of links in the operation row of a database log detail * page. */ private function verifyLinkEscaping() { @@ -268,10 +276,10 @@ private function verifyLinkEscaping() { // Check if the link exists (unescaped). $this->assertRaw($link); - // Check for XSS filtering + // Check for XSS filtering. $js_txt = 'This should not pop up!'; $js = ''; - $this->generateLogEntries(1, array( + $this->generateLogEntries(1, array( 'message' => $message, 'link' => $link . $js, )); @@ -282,9 +290,9 @@ private function verifyLinkEscaping() { // Check if the link exists (unescaped). $this->assertRaw($link); - // Check if javascript was escaped + // Check if javascript was escaped. $this->assertNoRaw($js, 'Detail view: javascript in link is blocked'); - $this->assertRaw($js_txt, 'Detail view: javascript text exists '); + $this->assertRaw($js_txt, 'Detail view: javascript text exists'); } /** @@ -307,10 +315,10 @@ private function verifyMessageEscaping() { // Check if the link exists (unescaped). $this->assertRaw($message); - // Check for XSS filtering + // Check for XSS filtering. $js_txt = 'This should not pop up!'; $js = ''; - $this->generateLogEntries(1, array( + $this->generateLogEntries(1, array( 'message' => $message . $js, 'link' => $link, )); @@ -321,7 +329,7 @@ private function verifyMessageEscaping() { // Check if the link exists (unescaped). $this->assertRaw($message); - // Check if javascript was escaped + // Check if javascript was escaped. $this->assertNoRaw($js, 'Detail view: javascript in message is blocked'); $this->assertRaw($js_txt, 'Detail view: javascript text exists '); } @@ -418,7 +426,11 @@ private function doUser() { */ private function doNode($type) { // Create user. - $perm = array('create ' . $type . ' content', 'edit own ' . $type . ' content', 'delete own ' . $type . ' content'); + $perm = array( + 'create ' . $type . ' content', + 'edit own ' . $type . ' content', + 'delete own ' . $type . ' content', + ); $user = $this->drupalCreateUser($perm); // Login user. $this->drupalLogin($user);