From b45af923af04f363bfdfaaef77c08d78f17df9e2 Mon Sep 17 00:00:00 2001
From: webchick <drupal@webchick.net>
Date: Tue, 6 Jan 2015 11:22:03 -0800
Subject: [PATCH] Issue #2382195 by tibbsa, subhojit777, tadityar, cilefen,
 Mile23: Clean-up simpletest module test members - ensure property definition
 and use of camelCase naming convention

---
 .../modules/block/src/Tests/BlockHtmlTest.php |   2 +-
 .../src/Tests/ConfigExportImportUITest.php    |   2 +-
 .../field_ui/src/Tests/FieldUIRouteTest.php   |   2 +-
 .../LanguageConfigOverrideImportTest.php      |   2 +-
 .../src/Tests/LocaleLocaleLookupTest.php      |   2 +-
 .../NodeAccessViewGrantsCacheContextTest.php  |   2 +-
 .../node/src/Tests/Views/FrontPageTest.php    |   2 +-
 .../rdf/src/Tests/StandardProfileTest.php     |   2 +-
 .../shortcut/src/Tests/ShortcutLinksTest.php  |   6 +-
 .../simpletest/src/InstallerTestBase.php      |   2 +-
 .../modules/simpletest/src/KernelTestBase.php |   4 +-
 core/modules/simpletest/src/TestBase.php      | 157 ++++++++++++++----
 .../simpletest/src/Tests/BrokenSetUpTest.php  |   2 +-
 .../InstallationProfileModuleTestsTest.php    |  11 +-
 .../OtherInstallationProfileTestsTest.php     |  11 +-
 .../simpletest/src/Tests/SimpleTestTest.php   |  32 +++-
 core/modules/simpletest/src/WebTestBase.php   |  88 +++++-----
 .../Tests/DrupalKernel/DrupalKernelTest.php   |   2 +-
 .../system/src/Tests/File/ConfigTest.php      |   2 +-
 .../src/Tests/File/HtaccessUnitTest.php       |   4 +-
 .../system/src/Tests/Image/ToolkitGdTest.php  |   2 +-
 .../Installer/DistributionProfileTest.php     |   2 +-
 .../src/Tests/Installer/InstallerTest.php     |   2 +-
 .../Installer/SingleVisibleProfileTest.php    |   2 +-
 .../system/src/Tests/Session/SessionTest.php  |   4 +-
 .../Tests/System/DateFormatsLockedTest.php    |   2 +-
 .../src/Tests/Update/UpdateScriptTest.php     |   2 +-
 27 files changed, 246 insertions(+), 107 deletions(-)

diff --git a/core/modules/block/src/Tests/BlockHtmlTest.php b/core/modules/block/src/Tests/BlockHtmlTest.php
index f9480c4f4390..fe6cce719262 100644
--- a/core/modules/block/src/Tests/BlockHtmlTest.php
+++ b/core/modules/block/src/Tests/BlockHtmlTest.php
@@ -26,7 +26,7 @@ class BlockHtmlTest extends WebTestBase {
   protected function setUp() {
     parent::setUp();
 
-    $this->drupalLogin($this->root_user);
+    $this->drupalLogin($this->rootUser);
 
     // Enable the test_html block, to test HTML ID and attributes.
     \Drupal::state()->set('block_test.attributes', array('data-custom-attribute' => 'foo'));
diff --git a/core/modules/config/src/Tests/ConfigExportImportUITest.php b/core/modules/config/src/Tests/ConfigExportImportUITest.php
index 3139d1db043c..8b1276a01964 100644
--- a/core/modules/config/src/Tests/ConfigExportImportUITest.php
+++ b/core/modules/config/src/Tests/ConfigExportImportUITest.php
@@ -46,7 +46,7 @@ protected function setUp() {
     // roles are created then the role is lost after import. If the roles
     // created have the same name then the sync will fail because they will
     // have different UUIDs.
-    $this->drupalLogin($this->root_user);
+    $this->drupalLogin($this->rootUser);
   }
 
   /**
diff --git a/core/modules/field_ui/src/Tests/FieldUIRouteTest.php b/core/modules/field_ui/src/Tests/FieldUIRouteTest.php
index f88d7a2b0d53..b97bc8399b4b 100644
--- a/core/modules/field_ui/src/Tests/FieldUIRouteTest.php
+++ b/core/modules/field_ui/src/Tests/FieldUIRouteTest.php
@@ -27,7 +27,7 @@ class FieldUIRouteTest extends WebTestBase {
   protected function setUp() {
     parent::setUp();
 
-    $this->drupalLogin($this->root_user);
+    $this->drupalLogin($this->rootUser);
   }
 
   /**
diff --git a/core/modules/language/src/Tests/LanguageConfigOverrideImportTest.php b/core/modules/language/src/Tests/LanguageConfigOverrideImportTest.php
index cedfb96e6c2a..537584dd4cd8 100644
--- a/core/modules/language/src/Tests/LanguageConfigOverrideImportTest.php
+++ b/core/modules/language/src/Tests/LanguageConfigOverrideImportTest.php
@@ -56,7 +56,7 @@ public function testConfigOverrideImport() {
     $this->drupalGet('fr');
     $this->assertText('FR default site name');
 
-    $this->drupalLogin($this->root_user);
+    $this->drupalLogin($this->rootUser);
     $this->drupalGet('admin/config/development/maintenance/translate/fr/edit');
     $this->assertText('FR message: @site is currently under maintenance. We should be back shortly. Thank you for your patience');
   }
diff --git a/core/modules/locale/src/Tests/LocaleLocaleLookupTest.php b/core/modules/locale/src/Tests/LocaleLocaleLookupTest.php
index 66f35e629afb..05220105ffe6 100644
--- a/core/modules/locale/src/Tests/LocaleLocaleLookupTest.php
+++ b/core/modules/locale/src/Tests/LocaleLocaleLookupTest.php
@@ -34,7 +34,7 @@ public function setUp() {
     ConfigurableLanguage::createFromLangcode('fr')->save();
     $this->config('system.site')->set('langcode', 'fr')->save();
 
-    $this->drupalLogin($this->root_user);
+    $this->drupalLogin($this->rootUser);
   }
 
   /**
diff --git a/core/modules/node/src/Tests/NodeAccessViewGrantsCacheContextTest.php b/core/modules/node/src/Tests/NodeAccessViewGrantsCacheContextTest.php
index 419e6af89f03..1cd8062dab41 100644
--- a/core/modules/node/src/Tests/NodeAccessViewGrantsCacheContextTest.php
+++ b/core/modules/node/src/Tests/NodeAccessViewGrantsCacheContextTest.php
@@ -53,7 +53,7 @@ protected function setUp() {
     $this->noAccessUser2 = $this->drupalCreateUser(array('access content overview', 'access content'));
 
     $this->userMapping = [
-      1 => $this->root_user,
+      1 => $this->rootUser,
       2 => $this->accessUser,
       3 => $this->noAccessUser,
     ];
diff --git a/core/modules/node/src/Tests/Views/FrontPageTest.php b/core/modules/node/src/Tests/Views/FrontPageTest.php
index 34ff389ab2d4..eb970d6bd7c6 100644
--- a/core/modules/node/src/Tests/Views/FrontPageTest.php
+++ b/core/modules/node/src/Tests/Views/FrontPageTest.php
@@ -165,7 +165,7 @@ public function testAdminFrontPage() {
     // contextual links to the homepage view. This verifies there are no errors.
     \Drupal::service('module_installer')->install(array('views_ui'));
     // Login root user with sufficient permissions.
-    $this->drupalLogin($this->root_user);
+    $this->drupalLogin($this->rootUser);
     // Test frontpage view.
     $this->drupalGet('node');
     $this->assertResponse(200);
diff --git a/core/modules/rdf/src/Tests/StandardProfileTest.php b/core/modules/rdf/src/Tests/StandardProfileTest.php
index 092cd5db12ab..40b58fb7f6a0 100644
--- a/core/modules/rdf/src/Tests/StandardProfileTest.php
+++ b/core/modules/rdf/src/Tests/StandardProfileTest.php
@@ -290,7 +290,7 @@ protected function doPageRdfaTests() {
    * Tests that user data is exposed on user page.
    */
   protected function doUserRdfaTests() {
-    $this->drupalLogin($this->root_user);
+    $this->drupalLogin($this->rootUser);
 
     // Feed the HTML into the parser.
     $graph = $this->getRdfGraph($this->adminUser->getSystemPath());
diff --git a/core/modules/shortcut/src/Tests/ShortcutLinksTest.php b/core/modules/shortcut/src/Tests/ShortcutLinksTest.php
index d9cb0c7fe28a..dd637f108fbc 100644
--- a/core/modules/shortcut/src/Tests/ShortcutLinksTest.php
+++ b/core/modules/shortcut/src/Tests/ShortcutLinksTest.php
@@ -104,7 +104,7 @@ public function testShortcutQuickLink() {
     $this->config('node.settings')->set('use_admin_theme', '1')->save();
     $this->container->get('router.builder')->rebuild();
 
-    $this->drupalLogin($this->root_user);
+    $this->drupalLogin($this->rootUser);
     $this->drupalGet('admin/config/system/cron');
 
     // Test the "Add to shortcuts" link.
@@ -165,7 +165,7 @@ public function testShortcutLinkChangePath() {
    * Tests that changing the route of a shortcut link works.
    */
   public function testShortcutLinkChangeRoute() {
-    $this->drupalLogin($this->root_user);
+    $this->drupalLogin($this->rootUser);
     $this->drupalGet('admin/content');
     $this->assertResponse(200);
     // Disable the view.
@@ -242,7 +242,7 @@ public function testAccessShortcutsPermission() {
       ->save();
 
     // Add cron to the default shortcut set.
-    $this->drupalLogin($this->root_user);
+    $this->drupalLogin($this->rootUser);
     $this->drupalGet('admin/config/system/cron');
     $this->clickLink('Add to Default shortcuts');
 
diff --git a/core/modules/simpletest/src/InstallerTestBase.php b/core/modules/simpletest/src/InstallerTestBase.php
index 09a71cb8fe72..d87718e303df 100644
--- a/core/modules/simpletest/src/InstallerTestBase.php
+++ b/core/modules/simpletest/src/InstallerTestBase.php
@@ -78,7 +78,7 @@ protected function setUp() {
     $this->isInstalled = FALSE;
 
     // Define information about the user 1 account.
-    $this->root_user = new UserSession(array(
+    $this->rootUser = new UserSession(array(
       'uid' => 1,
       'name' => 'admin',
       'mail' => 'admin@example.com',
diff --git a/core/modules/simpletest/src/KernelTestBase.php b/core/modules/simpletest/src/KernelTestBase.php
index 69911812031a..1ce9eefc0adf 100644
--- a/core/modules/simpletest/src/KernelTestBase.php
+++ b/core/modules/simpletest/src/KernelTestBase.php
@@ -209,8 +209,8 @@ protected function setUp() {
     // StreamWrapper APIs.
     // @todo Move StreamWrapper management into DrupalKernel.
     // @see https://drupal.org/node/2028109
-    file_prepare_directory($this->public_files_directory, FILE_CREATE_DIRECTORY | FILE_MODIFY_PERMISSIONS);
-    $this->settingsSet('file_public_path', $this->public_files_directory);
+    file_prepare_directory($this->publicFilesDirectory, FILE_CREATE_DIRECTORY | FILE_MODIFY_PERMISSIONS);
+    $this->settingsSet('file_public_path', $this->publicFilesDirectory);
     $this->streamWrappers = array();
     $this->registerStreamWrapper('public', 'Drupal\Core\StreamWrapper\PublicStream');
     // The temporary stream wrapper is able to operate both with and without
diff --git a/core/modules/simpletest/src/TestBase.php b/core/modules/simpletest/src/TestBase.php
index 97b362e5c30f..7eaf71bbd605 100644
--- a/core/modules/simpletest/src/TestBase.php
+++ b/core/modules/simpletest/src/TestBase.php
@@ -54,20 +54,6 @@ abstract class TestBase {
    */
   protected $databasePrefix = NULL;
 
-  /**
-   * The site directory of the original parent site.
-   *
-   * @var string
-   */
-  protected $originalSite;
-
-  /**
-   * The original file directory, before it was changed for testing purposes.
-   *
-   * @var string
-   */
-  protected $originalFileDirectory = NULL;
-
   /**
    * Time limit for the test.
    */
@@ -132,6 +118,60 @@ abstract class TestBase {
    */
   protected $verboseDirectory;
 
+  /**
+   * URL to the verbose output file directory.
+   *
+   * @var string
+   */
+  protected $verboseDirectoryUrl;
+
+  /**
+   * The original configuration (variables), if available.
+   *
+   * @var string
+   * @todo Remove all remnants of $GLOBALS['conf'].
+   * @see https://drupal.org/node/2183323
+   */
+  protected $originalConf;
+
+  /**
+   * The original configuration (variables).
+   *
+   * @var string
+   */
+  protected $originalConfig;
+
+  /**
+   * The original configuration directories.
+   *
+   * An array of paths keyed by the CONFIG_*_DIRECTORY constants defined by
+   * core/includes/bootstrap.inc.
+   *
+   * @var array
+   */
+  protected $originalConfigDirectories;
+
+  /**
+   * The original container.
+   *
+   * @var \Symfony\Component\DependencyInjection\ContainerInterface
+   */
+  protected $originalContainer;
+
+  /**
+   * The original file directory, before it was changed for testing purposes.
+   *
+   * @var string
+   */
+  protected $originalFileDirectory = NULL;
+
+  /**
+   * The original language.
+   *
+   * @var \Drupal\Core\Language\LanguageInterface
+   */
+  protected $originalLanguage;
+
   /**
    * The original database prefix when running inside Simpletest.
    *
@@ -140,17 +180,47 @@ abstract class TestBase {
   protected $originalPrefix;
 
   /**
-   * URL to the verbose output file directory.
+   * The original installation profile.
    *
    * @var string
    */
-  protected $verboseDirectoryUrl;
+  protected $originalProfile;
+
+  /**
+   * The name of the session cookie.
+   *
+   * @var string
+   */
+  protected $originalSessionName;
 
   /**
    * The settings array.
+   *
+   * @var array
    */
   protected $originalSettings;
 
+  /**
+   * The original array of shutdown function callbacks.
+   *
+   * @var array
+   */
+  protected $originalShutdownCallbacks;
+
+  /**
+   * The site directory of the original parent site.
+   *
+   * @var string
+   */
+  protected $originalSite;
+
+  /**
+   * The original user, before testing began.
+   *
+   * @var \Drupal\Core\Session\AccountProxyInterface
+   */
+  protected $originalUser;
+
   /**
    * The public file directory for the test environment.
    *
@@ -158,7 +228,7 @@ abstract class TestBase {
    *
    * @var string
    */
-  protected $public_files_directory;
+  protected $publicFilesDirectory;
 
   /**
    * The private file directory for the test environment.
@@ -167,7 +237,25 @@ abstract class TestBase {
    *
    * @var string
    */
-  protected $private_files_directory;
+  protected $privateFilesDirectory;
+
+  /**
+   * The temporary file directory for the test environment.
+   *
+   * This is set in TestBase::prepareEnvironment().
+   *
+   * @var string
+   */
+  protected $tempFilesDirectory;
+
+  /**
+   * The translation file directory for the test environment.
+   *
+   * This is set in TestBase::prepareEnvironment().
+   *
+   * @var string
+   */
+  protected $translationFilesDirectory;
 
   /**
    * Whether to die in case any test assertion fails.
@@ -206,11 +294,6 @@ abstract class TestBase {
    */
   protected $randomGenerator;
 
-  /**
-   * The name of the session cookie.
-   */
-  protected $originalSessionName;
-
   /**
    * Set to TRUE to strict check all configuration saved.
    *
@@ -220,6 +303,21 @@ abstract class TestBase {
    */
   protected $strictConfigSchema = TRUE;
 
+  /**
+   * HTTP authentication method (specified as a CURLAUTH_* constant).
+   *
+   * @var int
+   * @see http://php.net/manual/en/function.curl-setopt.php
+   */
+  protected $httpAuthMethod = CURLAUTH_BASIC;
+
+  /**
+   * HTTP authentication credentials (<username>:<password>).
+   *
+   * @var string
+   */
+  protected $httpAuthCredentials = NULL;
+
   /**
    * Constructor for Test.
    *
@@ -804,6 +902,7 @@ public function run(array $methods = array()) {
     if (!isset($this->verbose)) {
       $this->verbose = $simpletest_config->get('verbose');
     }
+
     if ($this->verbose) {
       // Initialize verbose debugging.
       $this->verbose = TRUE;
@@ -816,11 +915,11 @@ public function run(array $methods = array()) {
     }
     // HTTP auth settings (<username>:<password>) for the simpletest browser
     // when sending requests to the test site.
-    $this->httpauth_method = (int) $simpletest_config->get('httpauth.method');
+    $this->httpAuthMethod = (int) $simpletest_config->get('httpauth.method');
     $username = $simpletest_config->get('httpauth.username');
     $password = $simpletest_config->get('httpauth.password');
     if (!empty($username) && !empty($password)) {
-      $this->httpauth_credentials = $username . ':' . $password;
+      $this->httpAuthCredentials = $username . ':' . $password;
     }
 
     set_error_handler(array($this, 'errorHandler'));
@@ -1064,10 +1163,10 @@ private function prepareEnvironment() {
     file_prepare_directory($this->siteDirectory, FILE_CREATE_DIRECTORY | FILE_MODIFY_PERMISSIONS);
 
     // Prepare filesystem directory paths.
-    $this->public_files_directory = $this->siteDirectory . '/files';
-    $this->private_files_directory = $this->siteDirectory . '/private';
-    $this->temp_files_directory = $this->siteDirectory . '/temp';
-    $this->translation_files_directory = $this->siteDirectory . '/translations';
+    $this->publicFilesDirectory = $this->siteDirectory . '/files';
+    $this->privateFilesDirectory = $this->siteDirectory . '/private';
+    $this->tempFilesDirectory = $this->siteDirectory . '/temp';
+    $this->translationFilesDirectory = $this->siteDirectory . '/translations';
 
     $this->generatedTestFiles = FALSE;
 
diff --git a/core/modules/simpletest/src/Tests/BrokenSetUpTest.php b/core/modules/simpletest/src/Tests/BrokenSetUpTest.php
index 239a022952ce..6621545bf75b 100644
--- a/core/modules/simpletest/src/Tests/BrokenSetUpTest.php
+++ b/core/modules/simpletest/src/Tests/BrokenSetUpTest.php
@@ -41,7 +41,7 @@ protected function setUp() {
     if (!$this->isInChildSite()) {
       parent::setUp();
 
-      $this->sharedTriggerFile = $this->public_files_directory . '/trigger';
+      $this->sharedTriggerFile = $this->publicFilesDirectory . '/trigger';
 
       // Create and log in user.
       $admin_user = $this->drupalCreateUser(array('administer unit tests'));
diff --git a/core/modules/simpletest/src/Tests/InstallationProfileModuleTestsTest.php b/core/modules/simpletest/src/Tests/InstallationProfileModuleTestsTest.php
index 43b1c74b09e8..424469a204b8 100644
--- a/core/modules/simpletest/src/Tests/InstallationProfileModuleTestsTest.php
+++ b/core/modules/simpletest/src/Tests/InstallationProfileModuleTestsTest.php
@@ -23,6 +23,13 @@ class InstallationProfileModuleTestsTest extends WebTestBase {
    */
   public static $modules = array('simpletest');
 
+  /**
+   * An administrative user with permission to adminsiter unit tests.
+   *
+   * @var \Drupal\user\UserInterface
+   */
+  protected $adminUser;
+
   /**
    * Use the Testing profile.
    *
@@ -40,8 +47,8 @@ class InstallationProfileModuleTestsTest extends WebTestBase {
   protected function setUp() {
     parent::setUp();
 
-    $this->admin_user = $this->drupalCreateUser(array('administer unit tests'));
-    $this->drupalLogin($this->admin_user);
+    $this->adminUser = $this->drupalCreateUser(array('administer unit tests'));
+    $this->drupalLogin($this->adminUser);
   }
 
   /**
diff --git a/core/modules/simpletest/src/Tests/OtherInstallationProfileTestsTest.php b/core/modules/simpletest/src/Tests/OtherInstallationProfileTestsTest.php
index 6e6e01bf55a9..9cfbfff3a941 100644
--- a/core/modules/simpletest/src/Tests/OtherInstallationProfileTestsTest.php
+++ b/core/modules/simpletest/src/Tests/OtherInstallationProfileTestsTest.php
@@ -38,11 +38,18 @@ class OtherInstallationProfileTestsTest extends WebTestBase {
    */
   protected $profile = 'minimal';
 
+  /**
+   * An administrative user with permission to administer unit tests.
+   *
+   * @var \Drupal\user\UserInterface
+   */
+  protected $adminUser;
+
   protected function setUp() {
     parent::setUp();
 
-    $this->admin_user = $this->drupalCreateUser(array('administer unit tests'));
-    $this->drupalLogin($this->admin_user);
+    $this->adminUser = $this->drupalCreateUser(array('administer unit tests'));
+    $this->drupalLogin($this->adminUser);
   }
 
   /**
diff --git a/core/modules/simpletest/src/Tests/SimpleTestTest.php b/core/modules/simpletest/src/Tests/SimpleTestTest.php
index 69421197aaad..92a4529d7bf0 100644
--- a/core/modules/simpletest/src/Tests/SimpleTestTest.php
+++ b/core/modules/simpletest/src/Tests/SimpleTestTest.php
@@ -38,7 +38,7 @@ class SimpleTestTest extends WebTestBase {
    *
    * Used to ensure they are incrementing.
    */
-  protected $test_ids = array();
+  protected $testIds = array();
 
   /**
    * Translated fail message.
@@ -53,6 +53,20 @@ class SimpleTestTest extends WebTestBase {
    */
   private $passMessage = '';
 
+  /**
+   * A valid and recognized permission.
+   *
+   * @var string
+   */
+  protected $validPermission;
+
+  /**
+   * An invalid or unrecognized permission.
+   *
+   * @var string
+   */
+  protected $invalidPermission;
+
   protected function setUp() {
     if (!$this->isInChildSite()) {
       $php = <<<'EOD'
@@ -103,8 +117,8 @@ class: Drupal\Core\Cache\MemoryBackendFactory
   function testWebTestRunner() {
     $this->passMessage = t('SimpleTest pass.');
     $this->failMessage = t('SimpleTest fail.');
-    $this->valid_permission = 'access administration pages';
-    $this->invalid_permission = 'invalid permission';
+    $this->validPermission = 'access administration pages';
+    $this->invalidPermission = 'invalid permission';
 
     if ($this->isInChildSite()) {
       // Only run following code if this test is running itself through a CURL
@@ -128,7 +142,7 @@ function testWebTestRunner() {
 
       // Regression test for #290316.
       // Check that test_id is incrementing.
-      $this->assertTrue($this->test_ids[0] != $this->test_ids[1], 'Test ID is incrementing.');
+      $this->assertTrue($this->testIds[0] != $this->testIds[1], 'Test ID is incrementing.');
     }
   }
 
@@ -162,10 +176,10 @@ function stubTest() {
 
     // This causes the second to fourth of the fifteen passes asserted in
     // confirmStubResults().
-    $user = $this->drupalCreateUser(array($this->valid_permission), 'SimpleTestTest');
+    $user = $this->drupalCreateUser(array($this->validPermission), 'SimpleTestTest');
 
     // This causes the fifth of the five fails asserted in confirmStubResults().
-    $this->drupalCreateUser(array($this->invalid_permission));
+    $this->drupalCreateUser(array($this->invalidPermission));
 
     // Test logging in as a user.
     // This causes the fifth to ninth of the fifteen passes asserted in
@@ -215,8 +229,8 @@ function confirmStubTestResults() {
     $this->assertAssertion($this->passMessage, 'Other', 'Pass', 'SimpleTestTest.php', 'Drupal\simpletest\Tests\SimpleTestTest->stubTest()');
     $this->assertAssertion($this->failMessage, 'Other', 'Fail', 'SimpleTestTest.php', 'Drupal\simpletest\Tests\SimpleTestTest->stubTest()');
 
-    $this->assertAssertion(t('Created permissions: @perms', array('@perms' => $this->valid_permission)), 'Role', 'Pass', 'SimpleTestTest.php', 'Drupal\simpletest\Tests\SimpleTestTest->stubTest()');
-    $this->assertAssertion(t('Invalid permission %permission.', array('%permission' => $this->invalid_permission)), 'Role', 'Fail', 'SimpleTestTest.php', 'Drupal\simpletest\Tests\SimpleTestTest->stubTest()');
+    $this->assertAssertion(t('Created permissions: @perms', array('@perms' => $this->validPermission)), 'Role', 'Pass', 'SimpleTestTest.php', 'Drupal\simpletest\Tests\SimpleTestTest->stubTest()');
+    $this->assertAssertion(t('Invalid permission %permission.', array('%permission' => $this->invalidPermission)), 'Role', 'Fail', 'SimpleTestTest.php', 'Drupal\simpletest\Tests\SimpleTestTest->stubTest()');
 
     // Check that the user was logged in successfully.
     $this->assertAssertion('User SimpleTestTest successfully logged in.', 'User login', 'Pass', 'SimpleTestTest.php', 'Drupal\simpletest\Tests\SimpleTestTest->stubTest()');
@@ -237,7 +251,7 @@ function confirmStubTestResults() {
 
     $this->assertEqual('15 passes, 3 fails, 2 exceptions, 3 debug messages', $this->childTestResults['summary']);
 
-    $this->test_ids[] = $test_id = $this->getTestIdFromResults();
+    $this->testIds[] = $test_id = $this->getTestIdFromResults();
     $this->assertTrue($test_id, 'Found test ID in results.');
   }
 
diff --git a/core/modules/simpletest/src/WebTestBase.php b/core/modules/simpletest/src/WebTestBase.php
index af19adab2339..ec190a0492f1 100644
--- a/core/modules/simpletest/src/WebTestBase.php
+++ b/core/modules/simpletest/src/WebTestBase.php
@@ -67,6 +67,13 @@ abstract class WebTestBase extends TestBase {
    */
   protected $headers;
 
+  /**
+   * The cookies of the page currently loaded in the internal browser.
+   *
+   * @var array
+   */
+  protected $cookies;
+
   /**
    * Indicates that headers should be dumped if verbose output is enabled.
    *
@@ -84,6 +91,14 @@ abstract class WebTestBase extends TestBase {
    */
   protected $loggedInUser = FALSE;
 
+  /**
+   * The "#1" admin user.
+   *
+   * @var \Drupal\Core\Session\AccountInterface
+   */
+  protected $rootUser;
+
+
   /**
    * The current cookie file used by cURL.
    *
@@ -100,6 +115,13 @@ abstract class WebTestBase extends TestBase {
    */
   protected $additionalCurlOptions = array();
 
+  /**
+   * The original batch, before it was changed for testing purposes.
+   *
+   * @var array
+   */
+  protected $originalBatch;
+
   /**
    * The original user, before it was changed to a clean uid = 1 for testing.
    *
@@ -114,25 +136,15 @@ abstract class WebTestBase extends TestBase {
    */
   protected $originalShutdownCallbacks = array();
 
-  /**
-   * HTTP authentication method.
-   */
-  protected $httpauth_method = CURLAUTH_BASIC;
-
-  /**
-   * HTTP authentication credentials (<username>:<password>).
-   */
-  protected $httpauth_credentials = NULL;
-
   /**
    * The current session name, if available.
    */
-  protected $session_name = NULL;
+  protected $sessionName = NULL;
 
   /**
    * The current session ID, if available.
    */
-  protected $session_id = NULL;
+  protected $sessionId = NULL;
 
   /**
    * Whether the files were copied to the test files directory.
@@ -147,7 +159,7 @@ abstract class WebTestBase extends TestBase {
   /**
    * The number of redirects followed during the handling of a request.
    */
-  protected $redirect_count;
+  protected $redirectCount;
 
   /**
    * The kernel used in this test.
@@ -678,8 +690,8 @@ protected function drupalLogin(AccountInterface $account) {
     $this->drupalPostForm('user/login', $edit, t('Log in'));
 
     // @see WebTestBase::drupalUserIsLoggedIn()
-    if (isset($this->session_id)) {
-      $account->session_id = $this->session_id;
+    if (isset($this->sessionId)) {
+      $account->session_id = $this->sessionId;
     }
     $pass = $this->assert($this->drupalUserIsLoggedIn($account), format_string('User %name successfully logged in.', array('%name' => $account->getUsername())), 'User login');
     if ($pass) {
@@ -732,7 +744,7 @@ protected function drupalLogout() {
    *   The name of the session cookie.
    */
   public function getSessionName() {
-    return $this->session_name;
+    return $this->sessionName;
   }
 
   /**
@@ -759,7 +771,7 @@ protected function setUp() {
     $this->originalBatch = batch_get();
 
     // Define information about the user 1 account.
-    $this->root_user = new UserSession(array(
+    $this->rootUser = new UserSession(array(
       'uid' => 1,
       'name' => 'admin',
       'mail' => 'admin@example.com',
@@ -770,7 +782,7 @@ protected function setUp() {
     // proper session cookies were set on a response. Because the child site
     // uses the same session name as the test runner, it is necessary to make
     // that available to test-methods.
-    $this->session_name = $this->originalSessionName;
+    $this->sessionName = $this->originalSessionName;
 
     // Reset the static batch to remove Simpletest's batch operations.
     $batch = &batch_get();
@@ -791,11 +803,11 @@ protected function setUp() {
     // @see system_requirements()
     // @see TestBase::prepareEnvironment()
     $settings['settings']['file_public_path'] = (object) array(
-      'value' => $this->public_files_directory,
+      'value' => $this->publicFilesDirectory,
       'required' => TRUE,
     );
     $settings['settings']['file_private_path'] = (object) array(
-      'value' => $this->private_files_directory,
+      'value' => $this->privateFilesDirectory,
       'required' => TRUE,
     );
     // Save the original site directory path, so that extensions in the
@@ -875,10 +887,10 @@ protected function setUp() {
     // While these could be preset/enforced in settings.php like the public
     // files directory above, some tests expect them to be configurable in the
     // UI. If declared in settings.php, they would no longer be configurable.
-    file_prepare_directory($this->private_files_directory, FILE_CREATE_DIRECTORY);
-    file_prepare_directory($this->temp_files_directory, FILE_CREATE_DIRECTORY);
+    file_prepare_directory($this->privateFilesDirectory, FILE_CREATE_DIRECTORY);
+    file_prepare_directory($this->tempFilesDirectory, FILE_CREATE_DIRECTORY);
     $config->get('system.file')
-      ->set('path.temporary', $this->temp_files_directory)
+      ->set('path.temporary', $this->tempFilesDirectory)
       ->save();
 
     // Manually configure the test mail collector implementation to prevent
@@ -973,11 +985,11 @@ protected function installParameters() {
           'site_name' => 'Drupal',
           'site_mail' => 'simpletest@example.com',
           'account' => array(
-            'name' => $this->root_user->name,
-            'mail' => $this->root_user->getEmail(),
+            'name' => $this->rootUser->name,
+            'mail' => $this->rootUser->getEmail(),
             'pass' => array(
-              'pass1' => $this->root_user->pass_raw,
-              'pass2' => $this->root_user->pass_raw,
+              'pass1' => $this->rootUser->pass_raw,
+              'pass2' => $this->rootUser->pass_raw,
             ),
           ),
           // \Drupal\Core\Render\Element\Checkboxes::valueCallback() requires
@@ -1209,7 +1221,7 @@ protected function curlInitialize() {
       // Some versions/configurations of cURL break on a NULL cookie jar, so
       // supply a real file.
       if (empty($this->cookieFile)) {
-        $this->cookieFile = $this->public_files_directory . '/cookie.jar';
+        $this->cookieFile = $this->publicFilesDirectory . '/cookie.jar';
       }
 
       $curl_options = array(
@@ -1224,9 +1236,9 @@ protected function curlInitialize() {
         CURLOPT_HEADERFUNCTION => array(&$this, 'curlHeaderCallback'),
         CURLOPT_USERAGENT => $this->databasePrefix,
       );
-      if (isset($this->httpauth_credentials)) {
-        $curl_options[CURLOPT_HTTPAUTH] = $this->httpauth_method;
-        $curl_options[CURLOPT_USERPWD] = $this->httpauth_credentials;
+      if (isset($this->httpAuthCredentials)) {
+        $curl_options[CURLOPT_HTTPAUTH] = $this->httpAuthMethod;
+        $curl_options[CURLOPT_USERPWD] = $this->httpAuthCredentials;
       }
       // curl_setopt_array() returns FALSE if any of the specified options
       // cannot be set, and stops processing any further options.
@@ -1330,9 +1342,9 @@ protected function curlExec($curl_options, $redirect = FALSE) {
 
     if (!$redirect) {
       // Reset headers, the session ID and the redirect counter.
-      $this->session_id = NULL;
+      $this->sessionId = NULL;
       $this->headers = array();
-      $this->redirect_count = 0;
+      $this->redirectCount = 0;
     }
 
     $content = curl_exec($this->curlHandle);
@@ -1343,9 +1355,9 @@ protected function curlExec($curl_options, $redirect = FALSE) {
     // to prevent fragments being sent to the web server as part
     // of the request.
     // TODO: Remove this for Drupal 8, since fixed in curl 7.20.0.
-    if (in_array($status, array(300, 301, 302, 303, 305, 307)) && $this->redirect_count < $this->maximumRedirects) {
+    if (in_array($status, array(300, 301, 302, 303, 305, 307)) && $this->redirectCount < $this->maximumRedirects) {
       if ($this->drupalGetHeader('location')) {
-        $this->redirect_count++;
+        $this->redirectCount++;
         $curl_options = array();
         $curl_options[CURLOPT_URL] = $this->drupalGetHeader('location');
         $curl_options[CURLOPT_HTTPGET] = TRUE;
@@ -1404,12 +1416,12 @@ protected function curlHeaderCallback($curlHandler, $header) {
       $parts = array_map('trim', explode(';', $matches[2]));
       $value = array_shift($parts);
       $this->cookies[$name] = array('value' => $value, 'secure' => in_array('secure', $parts));
-      if ($name == $this->session_name) {
+      if ($name == $this->sessionName) {
         if ($value != 'deleted') {
-          $this->session_id = $value;
+          $this->sessionId = $value;
         }
         else {
-          $this->session_id = NULL;
+          $this->sessionId = NULL;
         }
       }
     }
diff --git a/core/modules/system/src/Tests/DrupalKernel/DrupalKernelTest.php b/core/modules/system/src/Tests/DrupalKernel/DrupalKernelTest.php
index 3c43f184baaf..31b7ad1004fd 100644
--- a/core/modules/system/src/Tests/DrupalKernel/DrupalKernelTest.php
+++ b/core/modules/system/src/Tests/DrupalKernel/DrupalKernelTest.php
@@ -30,7 +30,7 @@ protected function setUp() {
     $this->settingsSet('php_storage', array('service_container' => array(
       'bin' => 'service_container',
       'class' => 'Drupal\Component\PhpStorage\MTimeProtectedFileStorage',
-      'directory' => DRUPAL_ROOT . '/' . $this->public_files_directory . '/php',
+      'directory' => DRUPAL_ROOT . '/' . $this->publicFilesDirectory . '/php',
       'secret' => Settings::getHashSalt(),
     )));
   }
diff --git a/core/modules/system/src/Tests/File/ConfigTest.php b/core/modules/system/src/Tests/File/ConfigTest.php
index 4d3cf6f05d4a..4eb7bf143bb0 100644
--- a/core/modules/system/src/Tests/File/ConfigTest.php
+++ b/core/modules/system/src/Tests/File/ConfigTest.php
@@ -31,7 +31,7 @@ function testFileConfigurationPage() {
     // Set the file paths to non-default values.
     // The respective directories are created automatically
     // upon form submission.
-    $file_path = $this->public_files_directory;
+    $file_path = $this->publicFilesDirectory;
     $fields = array(
       'file_temporary_path' => $file_path . '/file_config_page_test/temporary',
       'file_default_scheme' => 'private',
diff --git a/core/modules/system/src/Tests/File/HtaccessUnitTest.php b/core/modules/system/src/Tests/File/HtaccessUnitTest.php
index ae66ff3ac28f..7d71a33087aa 100644
--- a/core/modules/system/src/Tests/File/HtaccessUnitTest.php
+++ b/core/modules/system/src/Tests/File/HtaccessUnitTest.php
@@ -22,8 +22,8 @@ class HtaccessUnitTest extends KernelTestBase {
    */
   function testHtaccessSave() {
     // Prepare test directories.
-    $public = $this->public_files_directory . '/test/public';
-    $private = $this->public_files_directory . '/test/private';
+    $public = $this->publicFilesDirectory . '/test/public';
+    $private = $this->publicFilesDirectory . '/test/private';
     $stream = 'public://test/stream';
 
     // Verify that file_save_htaccess() returns FALSE if .htaccess cannot be
diff --git a/core/modules/system/src/Tests/Image/ToolkitGdTest.php b/core/modules/system/src/Tests/Image/ToolkitGdTest.php
index a65e683dd4c0..f4face02af61 100644
--- a/core/modules/system/src/Tests/Image/ToolkitGdTest.php
+++ b/core/modules/system/src/Tests/Image/ToolkitGdTest.php
@@ -253,7 +253,7 @@ function testManipulations() {
     }
 
     // Prepare a directory for test file results.
-    $directory = $this->public_files_directory .'/imagetest';
+    $directory = $this->publicFilesDirectory .'/imagetest';
     file_prepare_directory($directory, FILE_CREATE_DIRECTORY);
 
     foreach ($files as $file) {
diff --git a/core/modules/system/src/Tests/Installer/DistributionProfileTest.php b/core/modules/system/src/Tests/Installer/DistributionProfileTest.php
index 05ed6f5d79aa..367510f21d4c 100644
--- a/core/modules/system/src/Tests/Installer/DistributionProfileTest.php
+++ b/core/modules/system/src/Tests/Installer/DistributionProfileTest.php
@@ -72,7 +72,7 @@ public function testInstalled() {
     $this->assertUrl('user/1');
     $this->assertResponse(200);
     // Confirm that we are logged-in after installation.
-    $this->assertText($this->root_user->getUsername());
+    $this->assertText($this->rootUser->getUsername());
   }
 
 }
diff --git a/core/modules/system/src/Tests/Installer/InstallerTest.php b/core/modules/system/src/Tests/Installer/InstallerTest.php
index 876e0652eb88..ee53a4e5b37c 100644
--- a/core/modules/system/src/Tests/Installer/InstallerTest.php
+++ b/core/modules/system/src/Tests/Installer/InstallerTest.php
@@ -23,7 +23,7 @@ public function testInstaller() {
     $this->assertUrl('user/1');
     $this->assertResponse(200);
     // Confirm that we are logged-in after installation.
-    $this->assertText($this->root_user->getUsername());
+    $this->assertText($this->rootUser->getUsername());
 
     // Verify that the confirmation message appears.
     require_once \Drupal::root() . '/core/includes/install.inc';
diff --git a/core/modules/system/src/Tests/Installer/SingleVisibleProfileTest.php b/core/modules/system/src/Tests/Installer/SingleVisibleProfileTest.php
index a6167036299b..35bcf74cd378 100644
--- a/core/modules/system/src/Tests/Installer/SingleVisibleProfileTest.php
+++ b/core/modules/system/src/Tests/Installer/SingleVisibleProfileTest.php
@@ -62,7 +62,7 @@ public function testInstalled() {
     $this->assertUrl('user/1');
     $this->assertResponse(200);
     // Confirm that we are logged-in after installation.
-    $this->assertText($this->root_user->getUsername());
+    $this->assertText($this->rootUser->getUsername());
     // Confirm that the minimal profile was installed.
     $this->assertEqual(drupal_get_profile(), 'minimal');
   }
diff --git a/core/modules/system/src/Tests/Session/SessionTest.php b/core/modules/system/src/Tests/Session/SessionTest.php
index 7e9c16ae10f6..bbe23f6f2073 100644
--- a/core/modules/system/src/Tests/Session/SessionTest.php
+++ b/core/modules/system/src/Tests/Session/SessionTest.php
@@ -285,10 +285,10 @@ function sessionReset($uid = 0) {
    */
   function assertSessionCookie($sent) {
     if ($sent) {
-      $this->assertNotNull($this->session_id, 'Session cookie was sent.');
+      $this->assertNotNull($this->sessionId, 'Session cookie was sent.');
     }
     else {
-      $this->assertNull($this->session_id, 'Session cookie was not sent.');
+      $this->assertNull($this->sessionId, 'Session cookie was not sent.');
     }
   }
 
diff --git a/core/modules/system/src/Tests/System/DateFormatsLockedTest.php b/core/modules/system/src/Tests/System/DateFormatsLockedTest.php
index 7f9d6c0e6c2b..13b70625ff2f 100644
--- a/core/modules/system/src/Tests/System/DateFormatsLockedTest.php
+++ b/core/modules/system/src/Tests/System/DateFormatsLockedTest.php
@@ -20,7 +20,7 @@ class DateFormatsLockedTest extends WebTestBase {
    * Tests attempts at listing, editing, and deleting locked date formats.
    */
   public function testDateLocking() {
-    $this->drupalLogin($this->root_user);
+    $this->drupalLogin($this->rootUser);
 
     // Locked date formats are not linked on the listing page, locked date
     // formats are clearly marked as such; unlocked formats are not marked as
diff --git a/core/modules/system/src/Tests/Update/UpdateScriptTest.php b/core/modules/system/src/Tests/Update/UpdateScriptTest.php
index 360f5a6b2b9e..5b09674e356a 100644
--- a/core/modules/system/src/Tests/Update/UpdateScriptTest.php
+++ b/core/modules/system/src/Tests/Update/UpdateScriptTest.php
@@ -55,7 +55,7 @@ function testUpdateAccess() {
     $this->assertResponse(200);
 
     // Access the update page as user 1.
-    $this->drupalLogin($this->root_user);
+    $this->drupalLogin($this->rootUser);
     $this->drupalGet($this->update_url, array('external' => TRUE));
     $this->assertResponse(200);
   }
-- 
GitLab