diff --git a/core/modules/dblog/src/Tests/DbLogTest.php b/core/modules/dblog/src/Tests/DbLogTest.php index 8f334d87f67ac3e8ca1ce739567da40ee02f9c98..ec34a6cd6d3bd90e916027b700948ba5518258bf 100644 --- a/core/modules/dblog/src/Tests/DbLogTest.php +++ b/core/modules/dblog/src/Tests/DbLogTest.php @@ -31,23 +31,23 @@ class DbLogTest extends WebTestBase { /** * A user with some relevant administrative permissions. * - * @var object + * @var \Drupal\user\UserInterface */ - protected $big_user; + protected $adminUser; /** * A user without any permissions. * - * @var object + * @var \Drupal\user\UserInterface */ - protected $any_user; + protected $webUser; protected function setUp() { parent::setUp(); // Create users with specific permissions. - $this->big_user = $this->drupalCreateUser(array('administer site configuration', 'access administration pages', 'access site reports', 'administer users')); - $this->any_user = $this->drupalCreateUser(array()); + $this->adminUser = $this->drupalCreateUser(array('administer site configuration', 'access administration pages', 'access site reports', 'administer users')); + $this->webUser = $this->drupalCreateUser(array()); } /** @@ -59,7 +59,7 @@ protected function setUp() { */ function testDbLog() { // Login the admin user. - $this->drupalLogin($this->big_user); + $this->drupalLogin($this->adminUser); $row_limit = 100; $this->verifyRowLimit($row_limit); @@ -77,7 +77,7 @@ function testDbLog() { } // Login the regular user. - $this->drupalLogin($this->any_user); + $this->drupalLogin($this->webUser); $this->verifyReports(403); } @@ -141,8 +141,8 @@ private function generateLogEntries($count, $type = 'custom', $severity = RfcLog 'variables' => array(), 'severity' => $severity, 'link' => NULL, - 'user' => $this->big_user, - 'uid' => $this->big_user->id(), + 'user' => $this->adminUser, + 'uid' => $this->adminUser->id(), 'request_uri' => $base_root . request_uri(), 'referer' => \Drupal::request()->server->get('HTTP_REFERER'), 'ip' => '127.0.0.1', @@ -277,7 +277,7 @@ private function doUser() { $this->assertTrue($count_before > 0, format_string('DBLog contains @count records for @name', array('@count' => $count_before, '@name' => $user->getUsername()))); // Login the admin user. - $this->drupalLogin($this->big_user); + $this->drupalLogin($this->adminUser); // Delete the user created at the start of this test. // We need to POST here to invoke batch_process() in the internal browser. $this->drupalPostForm('user/' . $user->id() . '/cancel', array('user_cancel_method' => 'user_cancel_reassign'), t('Cancel account')); @@ -363,7 +363,7 @@ private function doNode($type) { $this->assertResponse(403); // Login the admin user. - $this->drupalLogin($this->big_user); + $this->drupalLogin($this->adminUser); // View the database log report. $this->drupalGet('admin/reports/dblog'); $this->assertResponse(200); @@ -450,8 +450,8 @@ protected function testDBLogAddAndClear() { 'variables' => array(), 'severity' => RfcLogLevel::NOTICE, 'link' => NULL, - 'user' => $this->big_user, - 'uid' => $this->big_user->id(), + 'user' => $this->adminUser, + 'uid' => $this->adminUser->id(), 'request_uri' => $base_root . request_uri(), 'referer' => \Drupal::request()->server->get('HTTP_REFERER'), 'ip' => '127.0.0.1', @@ -462,7 +462,7 @@ protected function testDBLogAddAndClear() { // Make sure the table count has actually been incremented. $this->assertEqual($count + 1, db_query('SELECT COUNT(*) FROM {watchdog}')->fetchField(), format_string('\Drupal\dblog\Logger\DbLog->log() added an entry to the dblog :count', array(':count' => $count))); // Login the admin user. - $this->drupalLogin($this->big_user); + $this->drupalLogin($this->adminUser); // Post in order to clear the database table. $this->drupalPostForm('admin/reports/dblog', array(), t('Clear log messages')); // Confirm that the logs should be cleared. @@ -476,7 +476,7 @@ protected function testDBLogAddAndClear() { * Tests the database log filter functionality at admin/reports/dblog. */ protected function testFilter() { - $this->drupalLogin($this->big_user); + $this->drupalLogin($this->adminUser); // Clear the log to ensure that only generated entries will be found. db_delete('watchdog')->execute();