diff --git a/core/modules/simpletest/src/InstallerTestBase.php b/core/modules/simpletest/src/InstallerTestBase.php
index 6fa42f9..ebd9873 100644
--- a/core/modules/simpletest/src/InstallerTestBase.php
+++ b/core/modules/simpletest/src/InstallerTestBase.php
@@ -8,8 +8,11 @@
 namespace Drupal\simpletest;
 
 use Drupal\Core\DrupalKernel;
+use Drupal\Core\Language\Language;
 use Drupal\Core\Session\UserSession;
 use Drupal\Core\Site\Settings;
+use Symfony\Component\DependencyInjection\ContainerBuilder;
+use Symfony\Component\DependencyInjection\Reference;
 use Symfony\Component\HttpFoundation\Request;
 
 /**
@@ -94,6 +97,25 @@ protected function setUp() {
     // @see WebTestBase::translatePostValues()
     $this->parameters = $this->installParameters();
 
+    // Set up a minimal container (required by WebTestBase).
+    // @see install_begin_request()
+    $request = Request::create($GLOBALS['base_url'] . '/core/install.php');
+    $this->container = new ContainerBuilder();
+    $this->container
+      ->set('request', $request);
+    $this->container
+      ->setParameter('language.default_values', Language::$defaultValues);
+    $this->container
+      ->register('language.default', 'Drupal\Core\Language\LanguageDefault')
+      ->addArgument('%language.default_values%');
+    $this->container
+      ->register('language_manager', 'Drupal\Core\Language\LanguageManager')
+      ->addArgument(new Reference('language.default'));
+    $this->container
+      ->register('string_translation', 'Drupal\Core\StringTranslation\TranslationManager')
+      ->addArgument(new Reference('language_manager'));
+    \Drupal::setContainer($this->container);
+
     $this->drupalGet($GLOBALS['base_url'] . '/core/install.php');
 
     // Select language.
diff --git a/core/modules/simpletest/src/TestBase.php b/core/modules/simpletest/src/TestBase.php
index dd583f5..cabbd14 100644
--- a/core/modules/simpletest/src/TestBase.php
+++ b/core/modules/simpletest/src/TestBase.php
@@ -1092,29 +1092,9 @@ private function prepareEnvironment() {
     // Reset statics.
     drupal_static_reset();
 
-    // Reset and create a new service container.
-    $this->container = new ContainerBuilder();
-
-    // @todo Remove this once this class has no calls to t() and format_plural()
-    $this->container->setParameter('language.default_values', Language::$defaultValues);
-    $this->container->register('language.default', 'Drupal\Core\Language\LanguageDefault')
-      ->addArgument('%language.default_values%');
-    $this->container->register('language_manager', 'Drupal\Core\Language\LanguageManager')
-      ->addArgument(new Reference('language.default'));
-    $this->container->register('string_translation', 'Drupal\Core\StringTranslation\TranslationManager')
-      ->addArgument(new Reference('language_manager'));
-
-    // Register info parser.
-    $this->container->register('info_parser', 'Drupal\Core\Extension\InfoParser');
-
-    $request = Request::create('/');
-    $this->container->set('request', $request);
-
-    // Run all tests as a anonymous user by default, web tests will replace that
-    // during the test set up.
-    $this->container->set('current_user', new AnonymousUserSession());
-
-    \Drupal::setContainer($this->container);
+    // Ensure there is no service container.
+    $this->container = NULL;
+    \Drupal::setContainer(NULL);
 
     // Unset globals.
     unset($GLOBALS['config_directories']);
@@ -1182,7 +1162,7 @@ private function restoreEnvironment() {
     // which means they may need to access its filesystem and database.
     drupal_static_reset();
 
-    if ($this->container->has('state') && $state = $this->container->get('state')) {
+    if ($this->container && $this->container->has('state') && $state = $this->container->get('state')) {
       $captured_emails = $state->get('system.test_mail_collector') ?: array();
       $emailCount = count($captured_emails);
       if ($emailCount) {
@@ -1257,9 +1237,6 @@ private function restoreEnvironment() {
     // Restore original shutdown callbacks.
     $callbacks = &drupal_register_shutdown_function();
     $callbacks = $this->originalShutdownCallbacks;
-
-    // Restore original user session.
-    $this->container->set('current_user', $this->originalUser);
   }
 
   /**
diff --git a/core/modules/simpletest/src/Tests/MissingDependentModuleUnitTest.php b/core/modules/simpletest/src/Tests/MissingDependentModuleUnitTest.php
index 08874bd..1420c28 100644
--- a/core/modules/simpletest/src/Tests/MissingDependentModuleUnitTest.php
+++ b/core/modules/simpletest/src/Tests/MissingDependentModuleUnitTest.php
@@ -26,6 +26,6 @@ public static function getInfo() {
    * Ensure that this test will not be loaded despite its dependency.
    */
   function testFail() {
-    $this->fail(t('Running test with missing required module.'));
+    $this->fail('Running test with missing required module.');
   }
 }
diff --git a/core/modules/system/src/Tests/Common/HtmlIdentifierUnitTest.php b/core/modules/system/src/Tests/Common/HtmlIdentifierUnitTest.php
index ec9bbb4..cdfc45a 100644
--- a/core/modules/system/src/Tests/Common/HtmlIdentifierUnitTest.php
+++ b/core/modules/system/src/Tests/Common/HtmlIdentifierUnitTest.php
@@ -7,13 +7,12 @@
 
 namespace Drupal\system\Tests\Common;
 
-use Drupal\simpletest\UnitTestBase;
-use Symfony\Component\HttpFoundation\Request;
+use Drupal\simpletest\KernelTestBase;
 
 /**
  * Tests cleaning HTML identifiers.
  */
-class HtmlIdentifierUnitTest extends UnitTestBase {
+class HtmlIdentifierUnitTest extends KernelTestBase {
   public static function getInfo() {
     return array(
       'name' => 'HTML identifiers',
@@ -23,18 +22,6 @@ public static function getInfo() {
   }
 
   /**
-   * {@inheritdoc}
-   */
-  public function setUp() {
-    parent::setUp();
-
-    $container = \Drupal::getContainer();
-    $request = new Request();
-    $container->set('request', $request);
-    \Drupal::setContainer($container);
-  }
-
-  /**
    * Tests that drupal_clean_css_identifier() cleans the identifier properly.
    */
   function testDrupalCleanCSSIdentifier() {
diff --git a/core/modules/system/src/Tests/Common/SizeUnitTest.php b/core/modules/system/src/Tests/Common/SizeUnitTest.php
index c170fc4..680f010 100644
--- a/core/modules/system/src/Tests/Common/SizeUnitTest.php
+++ b/core/modules/system/src/Tests/Common/SizeUnitTest.php
@@ -8,12 +8,12 @@
 namespace Drupal\system\Tests\Common;
 
 use Drupal\Component\Utility\Bytes;
-use Drupal\simpletest\UnitTestBase;
+use Drupal\simpletest\KernelTestBase;
 
 /**
  * Tests file size parsing and formatting functions.
  */
-class SizeUnitTest extends UnitTestBase {
+class SizeUnitTest extends KernelTestBase {
   protected $exact_test_cases;
   protected $rounded_test_cases;
 
@@ -26,6 +26,7 @@ public static function getInfo() {
   }
 
   function setUp() {
+    parent::setUp();
     $kb = Bytes::KILOBYTE;
     $this->exact_test_cases = array(
       '1 byte' => 1,
@@ -45,7 +46,6 @@ function setUp() {
       round(67234178751368124 / ($this->exact_test_cases['1 PB']), 2) . ' PB' => 67234178751368124, // petabytes
       round(235346823821125814962843827 / ($this->exact_test_cases['1 YB']), 2) . ' YB' => 235346823821125814962843827, // yottabytes
     );
-    parent::setUp();
   }
 
   /**
diff --git a/core/modules/system/src/Tests/Common/TableSortExtenderUnitTest.php b/core/modules/system/src/Tests/Common/TableSortExtenderUnitTest.php
index 28091bd..4557da1 100644
--- a/core/modules/system/src/Tests/Common/TableSortExtenderUnitTest.php
+++ b/core/modules/system/src/Tests/Common/TableSortExtenderUnitTest.php
@@ -8,13 +8,13 @@
 namespace Drupal\system\Tests\Common;
 
 use Drupal\Component\Utility\String;
-use Drupal\simpletest\UnitTestBase;
+use Drupal\simpletest\KernelTestBase;
 use Symfony\Component\HttpFoundation\Request;
 
 /**
  * Tests table sorting features implemented in tablesort.inc.
  */
-class TableSortExtenderUnitTest extends UnitTestBase {
+class TableSortExtenderUnitTest extends KernelTestBase {
 
   public static function getInfo() {
     return array(
diff --git a/core/modules/system/src/Tests/Plugin/Discovery/DiscoveryTestBase.php b/core/modules/system/src/Tests/Plugin/Discovery/DiscoveryTestBase.php
index d58cf03..6313ce1 100644
--- a/core/modules/system/src/Tests/Plugin/Discovery/DiscoveryTestBase.php
+++ b/core/modules/system/src/Tests/Plugin/Discovery/DiscoveryTestBase.php
@@ -8,12 +8,12 @@
 namespace Drupal\system\Tests\Plugin\Discovery;
 
 use Drupal\Core\StringTranslation\TranslationWrapper;
-use Drupal\simpletest\UnitTestBase;
+use Drupal\simpletest\KernelTestBase;
 
 /**
  * Base class for plugin discovery tests.
  */
-abstract class DiscoveryTestBase extends UnitTestBase {
+abstract class DiscoveryTestBase extends KernelTestBase {
 
   /**
    * The discovery component to test.
@@ -46,7 +46,9 @@ function testDiscoveryInterface() {
     // Ensure that getDefinitions() returns the expected definitions.
     // For the arrays to be identical (instead of only equal), they must be
     // sorted equally, which seems unnecessary here.
-    $this->assertEqual($this->discovery->getDefinitions(), $this->expectedDefinitions);
+    // The discovered definitions may contain circular references; use a custom
+    // assertion message to prevent var_export() from getting called.
+    $this->assertEqual($this->discovery->getDefinitions(), $this->expectedDefinitions, 'Expected definitions found.');
 
     // Ensure that getDefinition() returns the expected definition.
     foreach ($this->expectedDefinitions as $id => $definition) {
diff --git a/core/modules/system/src/Tests/Plugin/PluginTestBase.php b/core/modules/system/src/Tests/Plugin/PluginTestBase.php
index 3508a05..8cf95a7 100644
--- a/core/modules/system/src/Tests/Plugin/PluginTestBase.php
+++ b/core/modules/system/src/Tests/Plugin/PluginTestBase.php
@@ -8,7 +8,7 @@
 namespace Drupal\system\Tests\Plugin;
 
 use Drupal\Core\Plugin\Context\ContextDefinition;
-use Drupal\simpletest\UnitTestBase;
+use Drupal\simpletest\KernelTestBase;
 use Drupal\plugin_test\Plugin\TestPluginManager;
 use Drupal\plugin_test\Plugin\MockBlockManager;
 use Drupal\plugin_test\Plugin\DefaultsTestPluginManager;
@@ -18,7 +18,15 @@
 /**
  * Base class for Plugin API unit tests.
  */
-abstract class PluginTestBase extends UnitTestBase {
+abstract class PluginTestBase extends KernelTestBase {
+
+  /**
+   * Modules to enable.
+   *
+   * @var array
+   */
+  public static $modules = array('plugin_test');
+
   protected $testPluginManager;
   protected $testPluginExpectedDefinitions;
   protected $mockBlockManager;
