diff --git a/core/modules/basic_auth/basic_auth.info.yml b/core/modules/basic_auth/basic_auth.info.yml
index 38bb7b2..1cf687b 100644
--- a/core/modules/basic_auth/basic_auth.info.yml
+++ b/core/modules/basic_auth/basic_auth.info.yml
@@ -4,3 +4,5 @@ description: 'Provides the HTTP Basic authentication provider'
 package: Web services
 version: VERSION
 core: 8.x
+dependencies:
+  - user
diff --git a/core/modules/system/src/Tests/Cache/GenericCacheBackendUnitTestBase.php b/core/modules/system/src/Tests/Cache/GenericCacheBackendUnitTestBase.php
index ebceb89..6c3d98f 100644
--- a/core/modules/system/src/Tests/Cache/GenericCacheBackendUnitTestBase.php
+++ b/core/modules/system/src/Tests/Cache/GenericCacheBackendUnitTestBase.php
@@ -15,6 +15,9 @@
  *
  * @see DatabaseBackendUnitTestCase
  *   For a full working implementation.
+ *
+ * @deprecated as of Drupal 8.2.x, will be removed before Drupal 9.0.0. Use
+ *    \Drupal\KernelTests\Core\Cache\GenericCacheBackendUnitTestBase instead.
  */
 abstract class GenericCacheBackendUnitTestBase extends KernelTestBase {
 
diff --git a/core/modules/system/src/Tests/Common/PageRenderTest.php b/core/modules/system/src/Tests/Common/PageRenderTest.php
index 8906982..f07ece6 100644
--- a/core/modules/system/src/Tests/Common/PageRenderTest.php
+++ b/core/modules/system/src/Tests/Common/PageRenderTest.php
@@ -2,7 +2,7 @@
 
 namespace Drupal\system\Tests\Common;
 
-use Drupal\simpletest\KernelTestBase;
+use Drupal\KernelTests\KernelTestBase;
 
 /**
  * Test page rendering hooks.
diff --git a/core/modules/system/src/Tests/Common/SystemListingTest.php b/core/modules/system/src/Tests/Common/SystemListingTest.php
index e2d5c6f..cf29be4 100644
--- a/core/modules/system/src/Tests/Common/SystemListingTest.php
+++ b/core/modules/system/src/Tests/Common/SystemListingTest.php
@@ -3,7 +3,7 @@
 namespace Drupal\system\Tests\Common;
 
 use Drupal\Core\Extension\ExtensionDiscovery;
-use Drupal\simpletest\KernelTestBase;
+use Drupal\KernelTests\KernelTestBase;
 
 /**
  * Tests scanning system directories in drupal_system_listing().
diff --git a/core/modules/system/src/Tests/Action/ActionUnitTest.php b/core/modules/system/tests/src/Kernel/Action/ActionTest.php
similarity index 96%
rename from core/modules/system/src/Tests/Action/ActionUnitTest.php
rename to core/modules/system/tests/src/Kernel/Action/ActionTest.php
index 92869e0..4ca24fb 100644
--- a/core/modules/system/src/Tests/Action/ActionUnitTest.php
+++ b/core/modules/system/tests/src/Kernel/Action/ActionTest.php
@@ -1,9 +1,9 @@
 <?php
 
-namespace Drupal\system\Tests\Action;
+namespace Drupal\Tests\system\Kernel\Action;
 
-use Drupal\simpletest\KernelTestBase;
 use Drupal\Core\Action\ActionInterface;
+use Drupal\KernelTests\KernelTestBase;
 use Drupal\system\Entity\Action;
 use Drupal\user\RoleInterface;
 
@@ -12,7 +12,7 @@
  *
  * @group Action
  */
-class ActionUnitTest extends KernelTestBase {
+class ActionTest extends KernelTestBase {
 
   /**
    * {@inheritdoc}
diff --git a/core/modules/system/src/Tests/Block/SystemMenuBlockTest.php b/core/modules/system/tests/src/Kernel/Block/SystemMenuBlockTest.php
similarity index 99%
rename from core/modules/system/src/Tests/Block/SystemMenuBlockTest.php
rename to core/modules/system/tests/src/Kernel/Block/SystemMenuBlockTest.php
index 8021fc8..ca1c5af 100644
--- a/core/modules/system/src/Tests/Block/SystemMenuBlockTest.php
+++ b/core/modules/system/tests/src/Kernel/Block/SystemMenuBlockTest.php
@@ -1,11 +1,11 @@
 <?php
 
-namespace Drupal\system\Tests\Block;
+namespace Drupal\Tests\system\Kernel\Block;
 
+use Drupal\KernelTests\KernelTestBase;
 use Drupal\system\Entity\Menu;
 use Drupal\block\Entity\Block;
 use Drupal\Core\Render\Element;
-use Drupal\simpletest\KernelTestBase;
 use Drupal\system\Tests\Routing\MockRouteProvider;
 use Drupal\Tests\Core\Menu\MenuLinkMock;
 use Drupal\user\Entity\User;
diff --git a/core/modules/system/src/Tests/System/InfoAlterTest.php b/core/modules/system/tests/src/Kernel/System/InfoAlterTest.php
similarity index 93%
rename from core/modules/system/src/Tests/System/InfoAlterTest.php
rename to core/modules/system/tests/src/Kernel/System/InfoAlterTest.php
index b09893b..8e6f79e 100644
--- a/core/modules/system/src/Tests/System/InfoAlterTest.php
+++ b/core/modules/system/tests/src/Kernel/System/InfoAlterTest.php
@@ -1,8 +1,8 @@
 <?php
 
-namespace Drupal\system\Tests\System;
+namespace Drupal\Tests\system\Kernel\System;
 
-use Drupal\simpletest\KernelTestBase;
+use Drupal\KernelTests\KernelTestBase;
 
 /**
  * Tests the effectiveness of hook_system_info_alter().
diff --git a/core/modules/system/tests/themes/test_basetheme/config/install/core.date_format.fancy.yml b/core/modules/system/tests/themes/test_basetheme/config/install/core.date_format.fancy.yml
index 2b962d6..b42fbae 100644
--- a/core/modules/system/tests/themes/test_basetheme/config/install/core.date_format.fancy.yml
+++ b/core/modules/system/tests/themes/test_basetheme/config/install/core.date_format.fancy.yml
@@ -1,6 +1,6 @@
 # Themes are not supposed to provide/install this kind of config normally.
 # This exists for testing purposes only.
-# @see \Drupal\system\Tests\Extension\ThemeInstallerTest
+# @see \Drupal\KernelTests\Core\Theme\ThemeInstallerTest
 id: fancy
 label: 'Fancy date'
 status: true
diff --git a/core/modules/system/src/Tests/Common/AttachedAssetsTest.php b/core/tests/Drupal/KernelTests/Core/Asset/AttachedAssetsTest.php
similarity index 98%
rename from core/modules/system/src/Tests/Common/AttachedAssetsTest.php
rename to core/tests/Drupal/KernelTests/Core/Asset/AttachedAssetsTest.php
index 8074669..72e7b6f 100644
--- a/core/modules/system/src/Tests/Common/AttachedAssetsTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Asset/AttachedAssetsTest.php
@@ -1,11 +1,11 @@
 <?php
 
-namespace Drupal\system\Tests\Common;
+namespace Drupal\KernelTests\Core\Asset;
 
 use Drupal\Component\Serialization\Json;
 use Drupal\Component\Utility\Unicode;
 use Drupal\Core\Asset\AttachedAssets;
-use Drupal\simpletest\KernelTestBase;
+use Drupal\KernelTests\KernelTestBase;
 
 /**
  * Tests #attached assets: attached asset libraries and JavaScript settings.
@@ -195,13 +195,16 @@ function testSettings() {
 
     $js = $this->assetResolver->getJsAssets($assets, FALSE)[1];
     $js_render_array = \Drupal::service('asset.js.collection_renderer')->render($js);
-    $rendered_js = $this->renderer->renderPlain($js_render_array);
+    // Cast to string since this returns a \Drupal\Core\Render\Markup object.
+    $rendered_js = (string) $this->renderer->renderPlain($js_render_array);
 
     // Parse the generated drupalSettings <script> back to a PHP representation.
     $startToken = '{';
     $endToken = '}';
     $start = strpos($rendered_js, $startToken);
     $end = strrpos($rendered_js, $endToken);
+    // Convert to a string, as $renderer_js is a \Drupal\Core\Render\Markup
+    // object.
     $json  = Unicode::substr($rendered_js, $start, $end - $start + 1);
     $parsed_settings = Json::decode($json);
 
diff --git a/core/modules/system/src/Tests/Asset/LibraryDiscoveryIntegrationTest.php b/core/tests/Drupal/KernelTests/Core/Asset/LibraryDiscoveryIntegrationTest.php
similarity index 99%
rename from core/modules/system/src/Tests/Asset/LibraryDiscoveryIntegrationTest.php
rename to core/tests/Drupal/KernelTests/Core/Asset/LibraryDiscoveryIntegrationTest.php
index d021f28..a77adfc 100644
--- a/core/modules/system/src/Tests/Asset/LibraryDiscoveryIntegrationTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Asset/LibraryDiscoveryIntegrationTest.php
@@ -1,6 +1,6 @@
 <?php
 
-namespace Drupal\system\Tests\Asset;
+namespace Drupal\KernelTests\Core\Asset;
 
 use Drupal\Core\Asset\Exception\InvalidLibrariesExtendSpecificationException;
 use Drupal\Core\Asset\Exception\InvalidLibrariesOverrideSpecificationException;
diff --git a/core/modules/system/src/Tests/Asset/ResolvedLibraryDefinitionsFilesMatchTest.php b/core/tests/Drupal/KernelTests/Core/Asset/ResolvedLibraryDefinitionsFilesMatchTest.php
similarity index 95%
rename from core/modules/system/src/Tests/Asset/ResolvedLibraryDefinitionsFilesMatchTest.php
rename to core/tests/Drupal/KernelTests/Core/Asset/ResolvedLibraryDefinitionsFilesMatchTest.php
index aab2ce2..c3d3e30 100644
--- a/core/modules/system/src/Tests/Asset/ResolvedLibraryDefinitionsFilesMatchTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Asset/ResolvedLibraryDefinitionsFilesMatchTest.php
@@ -1,8 +1,8 @@
 <?php
 
-namespace Drupal\system\Tests\Asset;
+namespace Drupal\KernelTests\Core\Asset;
 
-use Drupal\simpletest\KernelTestBase;
+use Drupal\KernelTests\KernelTestBase;
 
 /**
  * Tests that the asset files for all core libraries exist.
@@ -86,14 +86,14 @@ class ResolvedLibraryDefinitionsFilesMatchTest extends KernelTestBase {
   /**
    * {@inheritdoc}
    */
+  public static $modules = ['system'];
+
+  /**
+   * {@inheritdoc}
+   */
   protected function setUp() {
     parent::setUp();
 
-    $this->themeHandler = $this->container->get('theme_handler');
-    $this->themeInitialization = $this->container->get('theme.initialization');
-    $this->themeManager = $this->container->get('theme.manager');
-    $this->libraryDiscovery = $this->container->get('library.discovery');
-
     // Install all core themes.
     sort($this->allThemes);
     $this->container->get('theme_installer')->install($this->allThemes);
@@ -109,8 +109,14 @@ protected function setUp() {
       return TRUE;
     });
     $this->allModules = array_keys($all_modules);
+    $this->allModules[] = 'system';
     sort($this->allModules);
-    $this->enableModules($this->allModules);
+    $this->container->get('module_installer')->install($this->allModules);
+
+    $this->themeHandler = $this->container->get('theme_handler');
+    $this->themeInitialization = $this->container->get('theme.initialization');
+    $this->themeManager = $this->container->get('theme.manager');
+    $this->libraryDiscovery = $this->container->get('library.discovery');
   }
 
   /**
diff --git a/core/modules/system/src/Tests/Bootstrap/GetFilenameUnitTest.php b/core/tests/Drupal/KernelTests/Core/Bootstrap/GetFilenameTest.php
similarity index 91%
rename from core/modules/system/src/Tests/Bootstrap/GetFilenameUnitTest.php
rename to core/tests/Drupal/KernelTests/Core/Bootstrap/GetFilenameTest.php
index 50bbc6b..6cdc4b3 100644
--- a/core/modules/system/src/Tests/Bootstrap/GetFilenameUnitTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Bootstrap/GetFilenameTest.php
@@ -1,15 +1,20 @@
 <?php
 
-namespace Drupal\system\Tests\Bootstrap;
+namespace Drupal\KernelTests\Core\Bootstrap;
 
-use Drupal\simpletest\KernelTestBase;
+use Drupal\KernelTests\KernelTestBase;
 
 /**
  * Tests that drupal_get_filename() works correctly.
  *
  * @group Bootstrap
  */
-class GetFilenameUnitTest extends KernelTestBase {
+class GetFilenameTest extends KernelTestBase {
+
+  /**
+   * {@inheritdoc}
+   */
+  public static $modules = ['system'];
 
   /**
    * Tests that drupal_get_filename() works when the file is not in database.
diff --git a/core/modules/system/src/Tests/Bootstrap/ResettableStaticUnitTest.php b/core/tests/Drupal/KernelTests/Core/Bootstrap/ResettableStaticTest.php
similarity index 90%
rename from core/modules/system/src/Tests/Bootstrap/ResettableStaticUnitTest.php
rename to core/tests/Drupal/KernelTests/Core/Bootstrap/ResettableStaticTest.php
index b15c877..7b90ec1 100644
--- a/core/modules/system/src/Tests/Bootstrap/ResettableStaticUnitTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Bootstrap/ResettableStaticTest.php
@@ -1,15 +1,15 @@
 <?php
 
-namespace Drupal\system\Tests\Bootstrap;
+namespace Drupal\KernelTests\Core\Bootstrap;
 
-use Drupal\simpletest\KernelTestBase;
+use Drupal\KernelTests\KernelTestBase;
 
 /**
  * Tests that drupal_static() and drupal_static_reset() work.
  *
  * @group Bootstrap
  */
-class ResettableStaticUnitTest extends KernelTestBase {
+class ResettableStaticTest extends KernelTestBase {
 
   /**
    * Tests drupal_static() function.
diff --git a/core/modules/system/src/Tests/Cache/ApcuBackendUnitTest.php b/core/tests/Drupal/KernelTests/Core/Cache/ApcuBackendTest.php
similarity index 97%
rename from core/modules/system/src/Tests/Cache/ApcuBackendUnitTest.php
rename to core/tests/Drupal/KernelTests/Core/Cache/ApcuBackendTest.php
index 3305057..dd9ac9e 100644
--- a/core/modules/system/src/Tests/Cache/ApcuBackendUnitTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Cache/ApcuBackendTest.php
@@ -1,6 +1,6 @@
 <?php
 
-namespace Drupal\system\Tests\Cache;
+namespace Drupal\KernelTests\Core\Cache;
 
 use Drupal\Core\Cache\Apcu4Backend;
 use Drupal\Core\Cache\ApcuBackend;
@@ -11,7 +11,7 @@
  * @group Cache
  * @requires extension apc
  */
-class ApcuBackendUnitTest extends GenericCacheBackendUnitTestBase {
+class ApcuBackendTest extends GenericCacheBackendUnitTestBase {
 
   /**
    * Get a list of failed requirements.
diff --git a/core/modules/system/src/Tests/Cache/BackendChainUnitTest.php b/core/tests/Drupal/KernelTests/Core/Cache/BackendChainTest.php
similarity index 84%
rename from core/modules/system/src/Tests/Cache/BackendChainUnitTest.php
rename to core/tests/Drupal/KernelTests/Core/Cache/BackendChainTest.php
index 7e6c4ee..0282180 100644
--- a/core/modules/system/src/Tests/Cache/BackendChainUnitTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Cache/BackendChainTest.php
@@ -1,6 +1,6 @@
 <?php
 
-namespace Drupal\system\Tests\Cache;
+namespace Drupal\KernelTests\Core\Cache;
 
 use Drupal\Core\Cache\BackendChain;
 use Drupal\Core\Cache\MemoryBackend;
@@ -10,7 +10,7 @@
  *
  * @group Cache
  */
-class BackendChainUnitTest extends GenericCacheBackendUnitTestBase {
+class BackendChainTest extends GenericCacheBackendUnitTestBase {
 
   protected function createCacheBackend($bin) {
     $chain = new BackendChain($bin);
diff --git a/core/modules/system/src/Tests/Cache/CacheContextOptimizationTest.php b/core/tests/Drupal/KernelTests/Core/Cache/CacheContextOptimizationTest.php
similarity index 98%
rename from core/modules/system/src/Tests/Cache/CacheContextOptimizationTest.php
rename to core/tests/Drupal/KernelTests/Core/Cache/CacheContextOptimizationTest.php
index 698e03d..0ae0230 100644
--- a/core/modules/system/src/Tests/Cache/CacheContextOptimizationTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Cache/CacheContextOptimizationTest.php
@@ -1,8 +1,8 @@
 <?php
 
-namespace Drupal\system\Tests\Cache;
+namespace Drupal\KernelTests\Core\Cache;
 
-use Drupal\simpletest\KernelTestBase;
+use Drupal\KernelTests\KernelTestBase;
 use Drupal\simpletest\UserCreationTrait;
 use Drupal\user\Entity\Role;
 
diff --git a/core/modules/system/src/Tests/Cache/ChainedFastBackendUnitTest.php b/core/tests/Drupal/KernelTests/Core/Cache/ChainedFastBackendTest.php
similarity index 89%
rename from core/modules/system/src/Tests/Cache/ChainedFastBackendUnitTest.php
rename to core/tests/Drupal/KernelTests/Core/Cache/ChainedFastBackendTest.php
index f2ddcf2..3021b04 100644
--- a/core/modules/system/src/Tests/Cache/ChainedFastBackendUnitTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Cache/ChainedFastBackendTest.php
@@ -1,6 +1,6 @@
 <?php
 
-namespace Drupal\system\Tests\Cache;
+namespace Drupal\KernelTests\Core\Cache;
 
 use Drupal\Core\Cache\ChainedFastBackend;
 use Drupal\Core\Cache\DatabaseBackend;
@@ -11,7 +11,7 @@
  *
  * @group Cache
  */
-class ChainedFastBackendUnitTest extends GenericCacheBackendUnitTestBase {
+class ChainedFastBackendTest extends GenericCacheBackendUnitTestBase {
 
   /**
    * Creates a new instance of ChainedFastBackend.
diff --git a/core/modules/system/src/Tests/Cache/DatabaseBackendTagTest.php b/core/tests/Drupal/KernelTests/Core/Cache/DatabaseBackendTagTest.php
similarity index 91%
rename from core/modules/system/src/Tests/Cache/DatabaseBackendTagTest.php
rename to core/tests/Drupal/KernelTests/Core/Cache/DatabaseBackendTagTest.php
index 1be8df1..484ee9c 100644
--- a/core/modules/system/src/Tests/Cache/DatabaseBackendTagTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Cache/DatabaseBackendTagTest.php
@@ -1,10 +1,10 @@
 <?php
 
-namespace Drupal\system\Tests\Cache;
+namespace Drupal\KernelTests\Core\Cache;
 
 use Drupal\Core\Cache\Cache;
 use Drupal\Core\DependencyInjection\ContainerBuilder;
-use Drupal\simpletest\KernelTestBase;
+use Drupal\KernelTests\KernelTestBase;
 use Symfony\Component\DependencyInjection\Reference;
 
 /**
@@ -24,8 +24,8 @@ class DatabaseBackendTagTest extends KernelTestBase {
   /**
    * {@inheritdoc}
    */
-  public function containerBuild(ContainerBuilder $container) {
-    parent::containerBuild($container);
+  public function register(ContainerBuilder $container) {
+    parent::register($container);
     // Change container to database cache backends.
     $container
       ->register('cache_factory', 'Drupal\Core\Cache\CacheFactory')
diff --git a/core/modules/system/src/Tests/Cache/DatabaseBackendUnitTest.php b/core/tests/Drupal/KernelTests/Core/Cache/DatabaseBackendTest.php
similarity index 92%
rename from core/modules/system/src/Tests/Cache/DatabaseBackendUnitTest.php
rename to core/tests/Drupal/KernelTests/Core/Cache/DatabaseBackendTest.php
index 13630b5..fd1c942 100644
--- a/core/modules/system/src/Tests/Cache/DatabaseBackendUnitTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Cache/DatabaseBackendTest.php
@@ -1,6 +1,6 @@
 <?php
 
-namespace Drupal\system\Tests\Cache;
+namespace Drupal\KernelTests\Core\Cache;
 
 use Drupal\Core\Cache\DatabaseBackend;
 
@@ -9,7 +9,7 @@
  *
  * @group Cache
  */
-class DatabaseBackendUnitTest extends GenericCacheBackendUnitTestBase {
+class DatabaseBackendTest extends GenericCacheBackendUnitTestBase {
 
   /**
    * Modules to enable.
diff --git a/core/modules/system/src/Tests/Cache/GenericCacheBackendUnitTestBase.php b/core/tests/Drupal/KernelTests/Core/Cache/GenericCacheBackendUnitTestBase.php
similarity index 99%
copy from core/modules/system/src/Tests/Cache/GenericCacheBackendUnitTestBase.php
copy to core/tests/Drupal/KernelTests/Core/Cache/GenericCacheBackendUnitTestBase.php
index ebceb89..d5f3e95 100644
--- a/core/modules/system/src/Tests/Cache/GenericCacheBackendUnitTestBase.php
+++ b/core/tests/Drupal/KernelTests/Core/Cache/GenericCacheBackendUnitTestBase.php
@@ -1,10 +1,10 @@
 <?php
 
-namespace Drupal\system\Tests\Cache;
+namespace Drupal\KernelTests\Core\Cache;
 
 use Drupal\Core\Cache\Cache;
 use Drupal\Core\Cache\CacheBackendInterface;
-use Drupal\simpletest\KernelTestBase;
+use Drupal\KernelTests\KernelTestBase;
 
 /**
  * Tests any cache backend.
diff --git a/core/modules/system/src/Tests/Cache/MemoryBackendUnitTest.php b/core/tests/Drupal/KernelTests/Core/Cache/MemoryBackendTest.php
similarity index 80%
rename from core/modules/system/src/Tests/Cache/MemoryBackendUnitTest.php
rename to core/tests/Drupal/KernelTests/Core/Cache/MemoryBackendTest.php
index 6a37b81..c1fb9f7 100644
--- a/core/modules/system/src/Tests/Cache/MemoryBackendUnitTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Cache/MemoryBackendTest.php
@@ -1,6 +1,6 @@
 <?php
 
-namespace Drupal\system\Tests\Cache;
+namespace Drupal\KernelTests\Core\Cache;
 
 use Drupal\Core\Cache\MemoryBackend;
 
@@ -9,7 +9,7 @@
  *
  * @group Cache
  */
-class MemoryBackendUnitTest extends GenericCacheBackendUnitTestBase {
+class MemoryBackendTest extends GenericCacheBackendUnitTestBase {
 
   /**
    * Creates a new instance of MemoryBackend.
diff --git a/core/modules/system/src/Tests/Cache/PhpBackendUnitTest.php b/core/tests/Drupal/KernelTests/Core/Cache/PhpBackendTest.php
similarity index 80%
rename from core/modules/system/src/Tests/Cache/PhpBackendUnitTest.php
rename to core/tests/Drupal/KernelTests/Core/Cache/PhpBackendTest.php
index bcd5eef..486d2d4 100644
--- a/core/modules/system/src/Tests/Cache/PhpBackendUnitTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Cache/PhpBackendTest.php
@@ -1,6 +1,6 @@
 <?php
 
-namespace Drupal\system\Tests\Cache;
+namespace Drupal\KernelTests\Core\Cache;
 
 use Drupal\Core\Cache\PhpBackend;
 
@@ -9,7 +9,7 @@
  *
  * @group Cache
  */
-class PhpBackendUnitTest extends GenericCacheBackendUnitTestBase {
+class PhpBackendTest extends GenericCacheBackendUnitTestBase {
 
   /**
    * Creates a new instance of MemoryBackend.
diff --git a/core/modules/system/src/Tests/Update/DbDumpTest.php b/core/tests/Drupal/KernelTests/Core/Command/DbDumpTest.php
similarity index 97%
rename from core/modules/system/src/Tests/Update/DbDumpTest.php
rename to core/tests/Drupal/KernelTests/Core/Command/DbDumpTest.php
index 3a6a927..7ff414c 100644
--- a/core/modules/system/src/Tests/Update/DbDumpTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Command/DbDumpTest.php
@@ -1,13 +1,13 @@
 <?php
 
-namespace Drupal\system\Tests\Update;
+namespace Drupal\KernelTests\Core\Command;
 
 use Drupal\Component\Utility\SafeMarkup;
 use Drupal\Core\Command\DbDumpApplication;
 use Drupal\Core\Config\DatabaseStorage;
 use Drupal\Core\Database\Database;
 use Drupal\Core\DependencyInjection\ContainerBuilder;
-use Drupal\simpletest\KernelTestBase;
+use Drupal\KernelTests\KernelTestBase;
 use Drupal\user\Entity\User;
 use Symfony\Component\Console\Tester\CommandTester;
 use Symfony\Component\DependencyInjection\Reference;
@@ -66,8 +66,8 @@ class DbDumpTest extends KernelTestBase {
    *
    * Register a database cache backend rather than memory-based.
    */
-  public function containerBuild(ContainerBuilder $container) {
-    parent::containerBuild($container);
+  public function register(ContainerBuilder $container) {
+    parent::register($container);
     $container->register('cache_factory', 'Drupal\Core\Cache\DatabaseBackendFactory')
       ->addArgument(new Reference('database'))
       ->addArgument(new Reference('cache_tags.invalidator.checksum'));
@@ -121,6 +121,7 @@ protected function setUp() {
       'cachetags',
       'config',
       'cache_bootstrap',
+      'cache_config',
       'cache_data',
       'cache_default',
       'cache_discovery',
diff --git a/core/modules/system/src/Tests/Common/SizeUnitTest.php b/core/tests/Drupal/KernelTests/Core/Common/SizeTest.php
similarity index 94%
rename from core/modules/system/src/Tests/Common/SizeUnitTest.php
rename to core/tests/Drupal/KernelTests/Core/Common/SizeTest.php
index 39c06bb..2bcee75 100644
--- a/core/modules/system/src/Tests/Common/SizeUnitTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Common/SizeTest.php
@@ -1,9 +1,9 @@
 <?php
 
-namespace Drupal\system\Tests\Common;
+namespace Drupal\KernelTests\Core\Common;
 
 use Drupal\Component\Utility\Bytes;
-use Drupal\simpletest\KernelTestBase;
+use Drupal\KernelTests\KernelTestBase;
 
 /**
  * Parse a predefined amount of bytes and compare the output with the expected
@@ -11,7 +11,7 @@
  *
  * @group Common
  */
-class SizeUnitTest extends KernelTestBase {
+class SizeTest extends KernelTestBase {
   protected $exactTestCases;
   protected $roundedTestCases;
 
diff --git a/core/modules/system/src/Tests/Common/XssUnitTest.php b/core/tests/Drupal/KernelTests/Core/Common/XssUnitTest.php
similarity index 96%
rename from core/modules/system/src/Tests/Common/XssUnitTest.php
rename to core/tests/Drupal/KernelTests/Core/Common/XssUnitTest.php
index 1797737..7c68ed4 100644
--- a/core/modules/system/src/Tests/Common/XssUnitTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Common/XssUnitTest.php
@@ -1,9 +1,9 @@
 <?php
 
-namespace Drupal\system\Tests\Common;
+namespace Drupal\KernelTests\Core\Common;
 
 use Drupal\Component\Utility\UrlHelper;
-use Drupal\simpletest\KernelTestBase;
+use Drupal\KernelTests\KernelTestBase;
 
 /**
  * Confirm that \Drupal\Component\Utility\Xss::filter() and check_url() work
diff --git a/core/modules/system/src/Tests/DrupalKernel/DrupalKernelSiteTest.php b/core/tests/Drupal/KernelTests/Core/DrupalKernel/DrupalKernelSiteTest.php
similarity index 90%
rename from core/modules/system/src/Tests/DrupalKernel/DrupalKernelSiteTest.php
rename to core/tests/Drupal/KernelTests/Core/DrupalKernel/DrupalKernelSiteTest.php
index 51687db..deea2a9 100644
--- a/core/modules/system/src/Tests/DrupalKernel/DrupalKernelSiteTest.php
+++ b/core/tests/Drupal/KernelTests/Core/DrupalKernel/DrupalKernelSiteTest.php
@@ -1,9 +1,9 @@
 <?php
 
-namespace Drupal\system\Tests\DrupalKernel;
+namespace Drupal\KernelTests\Core\DrupalKernel;
 
 use Drupal\Core\Site\Settings;
-use Drupal\simpletest\KernelTestBase;
+use Drupal\KernelTests\KernelTestBase;
 
 /**
  * Tests site-specific service overrides.
@@ -18,7 +18,7 @@ class DrupalKernelSiteTest extends KernelTestBase {
   public function testServicesYml() {
     $container_yamls = Settings::get('container_yamls');
     $container_yamls[] = $this->siteDirectory . '/services.yml';
-    $this->settingsSet('container_yamls', $container_yamls);
+    $this->setSetting('container_yamls', $container_yamls);
     $this->assertFalse($this->container->has('site.service.yml'));
     // A service provider class always has precedence over services.yml files.
     // KernelTestBase::buildContainer() swaps out many services with in-memory
diff --git a/core/modules/system/src/Tests/DrupalKernel/ServiceDestructionTest.php b/core/tests/Drupal/KernelTests/Core/DrupalKernel/ServiceDestructionTest.php
similarity index 95%
rename from core/modules/system/src/Tests/DrupalKernel/ServiceDestructionTest.php
rename to core/tests/Drupal/KernelTests/Core/DrupalKernel/ServiceDestructionTest.php
index cc1a381..f4fe094 100644
--- a/core/modules/system/src/Tests/DrupalKernel/ServiceDestructionTest.php
+++ b/core/tests/Drupal/KernelTests/Core/DrupalKernel/ServiceDestructionTest.php
@@ -1,8 +1,8 @@
 <?php
 
-namespace Drupal\system\Tests\DrupalKernel;
+namespace Drupal\KernelTests\Core\DrupalKernel;
 
-use Drupal\simpletest\KernelTestBase;
+use Drupal\KernelTests\KernelTestBase;
 use Symfony\Component\HttpFoundation\Response;
 
 /**
diff --git a/core/modules/system/src/Tests/Element/PathElementFormTest.php b/core/tests/Drupal/KernelTests/Core/Element/PathElementFormTest.php
similarity index 98%
rename from core/modules/system/src/Tests/Element/PathElementFormTest.php
rename to core/tests/Drupal/KernelTests/Core/Element/PathElementFormTest.php
index 0cb15a1..ca4e501 100644
--- a/core/modules/system/src/Tests/Element/PathElementFormTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Element/PathElementFormTest.php
@@ -1,13 +1,13 @@
 <?php
 
-namespace Drupal\system\Tests\Element;
+namespace Drupal\KernelTests\Core\Element;
 
 use Drupal\Core\Form\FormInterface;
 use Drupal\Core\Form\FormState;
 use Drupal\Core\Form\FormStateInterface;
 use Drupal\Core\Render\Element\PathElement;
 use Drupal\Core\Url;
-use Drupal\simpletest\KernelTestBase;
+use Drupal\KernelTests\KernelTestBase;
 use Drupal\user\Entity\Role;
 use Drupal\user\Entity\User;
 
diff --git a/core/modules/system/src/Tests/System/IgnoreReplicaSubscriberTest.php b/core/tests/Drupal/KernelTests/Core/EventSubscriber/IgnoreReplicaSubscriberTest.php
similarity index 94%
rename from core/modules/system/src/Tests/System/IgnoreReplicaSubscriberTest.php
rename to core/tests/Drupal/KernelTests/Core/EventSubscriber/IgnoreReplicaSubscriberTest.php
index 8b35bdf..5131537 100644
--- a/core/modules/system/src/Tests/System/IgnoreReplicaSubscriberTest.php
+++ b/core/tests/Drupal/KernelTests/Core/EventSubscriber/IgnoreReplicaSubscriberTest.php
@@ -1,11 +1,11 @@
 <?php
 
-namespace Drupal\system\Tests\System;
+namespace Drupal\KernelTests\Core\EventSubscriber;
 
 use Drupal\Core\Database\Database;
 use Drupal\Core\EventSubscriber\ReplicaDatabaseIgnoreSubscriber;
 use Drupal\Core\DrupalKernel;
-use Drupal\simpletest\KernelTestBase;
+use Drupal\KernelTests\KernelTestBase;
 use Symfony\Component\HttpFoundation\Request;
 use Symfony\Component\HttpKernel\HttpKernelInterface;
 use Symfony\Component\HttpKernel\Event\GetResponseEvent;
diff --git a/core/modules/system/src/Tests/Module/ModuleImplementsAlterTest.php b/core/tests/Drupal/KernelTests/Core/Extension/ModuleImplementsAlterTest.php
similarity index 95%
rename from core/modules/system/src/Tests/Module/ModuleImplementsAlterTest.php
rename to core/tests/Drupal/KernelTests/Core/Extension/ModuleImplementsAlterTest.php
index 585e81e..f55d744 100644
--- a/core/modules/system/src/Tests/Module/ModuleImplementsAlterTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Extension/ModuleImplementsAlterTest.php
@@ -1,8 +1,8 @@
 <?php
 
-namespace Drupal\system\Tests\Module;
+namespace Drupal\KernelTests\Core\Extension;
 
-use Drupal\simpletest\KernelTestBase;
+use Drupal\KernelTests\KernelTestBase;
 
 /**
  * Tests hook_module_implements_alter().
@@ -12,6 +12,11 @@
 class ModuleImplementsAlterTest extends KernelTestBase {
 
   /**
+   * {@inheritdoc}
+   */
+  public static $modules = ['system'];
+
+  /**
    * Tests hook_module_implements_alter() adding an implementation.
    *
    * @see \Drupal\Core\Extension\ModuleHandler::buildImplementationInfo()
diff --git a/core/modules/system/src/Tests/File/DirectoryTest.php b/core/tests/Drupal/KernelTests/Core/File/DirectoryTest.php
similarity index 98%
rename from core/modules/system/src/Tests/File/DirectoryTest.php
rename to core/tests/Drupal/KernelTests/Core/File/DirectoryTest.php
index 5e9e44a..774bd7c 100644
--- a/core/modules/system/src/Tests/File/DirectoryTest.php
+++ b/core/tests/Drupal/KernelTests/Core/File/DirectoryTest.php
@@ -1,6 +1,6 @@
 <?php
 
-namespace Drupal\system\Tests\File;
+namespace Drupal\KernelTests\Core\File;
 
 use Drupal\Component\PhpStorage\FileStorage;
 
@@ -10,6 +10,7 @@
  * @group File
  */
 class DirectoryTest extends FileTestBase {
+
   /**
    * Test local directory handling functions.
    */
@@ -77,7 +78,7 @@ function testFileCheckDirectoryHandling() {
       $this->assertFalse(file_prepare_directory($directory, 0), 'Error reported for a non-writeable directory.', 'File');
 
       // Test directory permission modification.
-      $this->settingsSet('file_chmod_directory', 0777);
+      $this->setSetting('file_chmod_directory', 0777);
       $this->assertTrue(file_prepare_directory($directory, FILE_MODIFY_PERMISSIONS), 'No error reported when making directory writeable.', 'File');
     }
 
diff --git a/core/modules/system/src/Tests/File/FileTestBase.php b/core/tests/Drupal/KernelTests/Core/File/FileTestBase.php
similarity index 81%
rename from core/modules/system/src/Tests/File/FileTestBase.php
rename to core/tests/Drupal/KernelTests/Core/File/FileTestBase.php
index 219ff6c..548d1bc 100644
--- a/core/modules/system/src/Tests/File/FileTestBase.php
+++ b/core/tests/Drupal/KernelTests/Core/File/FileTestBase.php
@@ -1,8 +1,9 @@
 <?php
 
-namespace Drupal\system\Tests\File;
+namespace Drupal\KernelTests\Core\File;
 
-use Drupal\simpletest\KernelTestBase;
+use Drupal\Core\DependencyInjection\ContainerBuilder;
+use Drupal\KernelTests\KernelTestBase;
 
 /**
  * Base class for file tests that adds some additional file specific
@@ -31,17 +32,50 @@
    */
   protected $classname;
 
+  /**
+   * {@inheritdoc}
+   */
   protected function setUp() {
     parent::setUp();
-    $this->installConfig(array('system'));
-    $this->registerStreamWrapper('private', 'Drupal\Core\StreamWrapper\PrivateStream');
+
+    \Drupal::configFactory()->getEditable('system.file')->set('default_scheme', 'public')->save();
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function register(ContainerBuilder $container) {
+    parent::register($container);
+
+    $container->register('stream_wrapper.private', 'Drupal\Core\StreamWrapper\PrivateStream')
+      ->addTag('stream_wrapper', ['scheme' => 'private']);
 
     if (isset($this->scheme)) {
-      $this->registerStreamWrapper($this->scheme, $this->classname);
+      $container->register('stream_wrapper.' . $this->scheme, $this->classname)
+        ->addTag('stream_wrapper', ['scheme' => $this->scheme]);
     }
   }
 
   /**
+   * {@inheritdoc}
+   */
+  protected function setUpFilesystem() {
+    $public_file_directory = $this->siteDirectory . '/files';
+
+    require_once 'core/includes/file.inc';
+
+    mkdir($this->siteDirectory, 0775);
+    mkdir($this->siteDirectory . '/files', 0775);
+    mkdir($this->siteDirectory . '/files/config/' . CONFIG_SYNC_DIRECTORY, 0775, TRUE);
+
+    $this->setSetting('file_public_path', $public_file_directory);
+
+    $GLOBALS['config_directories'] = array(
+      CONFIG_SYNC_DIRECTORY => $this->siteDirectory . '/files/config/sync',
+    );
+  }
+
+  /**
    * Helper function to test the permissions of a file.
    *
    * @param $filepath
diff --git a/core/modules/system/src/Tests/File/HtaccessUnitTest.php b/core/tests/Drupal/KernelTests/Core/File/HtaccessTest.php
similarity index 92%
rename from core/modules/system/src/Tests/File/HtaccessUnitTest.php
rename to core/tests/Drupal/KernelTests/Core/File/HtaccessTest.php
index 2ddca7d..0ef5078 100644
--- a/core/modules/system/src/Tests/File/HtaccessUnitTest.php
+++ b/core/tests/Drupal/KernelTests/Core/File/HtaccessTest.php
@@ -1,24 +1,25 @@
 <?php
 
-namespace Drupal\system\Tests\File;
+namespace Drupal\KernelTests\Core\File;
 
 use Drupal\Component\Utility\SafeMarkup;
-use Drupal\simpletest\KernelTestBase;
+use Drupal\Core\Site\Settings;
+use Drupal\KernelTests\KernelTestBase;
 
 /**
  * Tests .htaccess file saving.
  *
  * @group File
  */
-class HtaccessUnitTest extends KernelTestBase {
+class HtaccessTest extends KernelTestBase {
 
   /**
    * Tests file_save_htaccess().
    */
   function testHtaccessSave() {
     // Prepare test directories.
-    $public = $this->publicFilesDirectory . '/test/public';
-    $private = $this->publicFilesDirectory . '/test/private';
+    $public = Settings::get('file_public_path') . '/test/public';
+    $private = Settings::get('file_public_path') . '/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/File/MimeTypeTest.php b/core/tests/Drupal/KernelTests/Core/File/MimeTypeTest.php
similarity index 98%
rename from core/modules/system/src/Tests/File/MimeTypeTest.php
rename to core/tests/Drupal/KernelTests/Core/File/MimeTypeTest.php
index 8120c0a..00fdf58 100644
--- a/core/modules/system/src/Tests/File/MimeTypeTest.php
+++ b/core/tests/Drupal/KernelTests/Core/File/MimeTypeTest.php
@@ -1,6 +1,6 @@
 <?php
 
-namespace Drupal\system\Tests\File;
+namespace Drupal\KernelTests\Core\File;
 
 /**
  * Tests filename mimetype detection.
diff --git a/core/modules/system/src/Tests/File/NameMungingTest.php b/core/tests/Drupal/KernelTests/Core/File/NameMungingTest.php
similarity index 98%
rename from core/modules/system/src/Tests/File/NameMungingTest.php
rename to core/tests/Drupal/KernelTests/Core/File/NameMungingTest.php
index 52163fc..1fff41e 100644
--- a/core/modules/system/src/Tests/File/NameMungingTest.php
+++ b/core/tests/Drupal/KernelTests/Core/File/NameMungingTest.php
@@ -1,6 +1,6 @@
 <?php
 
-namespace Drupal\system\Tests\File;
+namespace Drupal\KernelTests\Core\File;
 
 /**
  * Tests filename munging and unmunging.
diff --git a/core/modules/system/src/Tests/File/ReadOnlyStreamWrapperTest.php b/core/tests/Drupal/KernelTests/Core/File/ReadOnlyStreamWrapperTest.php
similarity index 99%
rename from core/modules/system/src/Tests/File/ReadOnlyStreamWrapperTest.php
rename to core/tests/Drupal/KernelTests/Core/File/ReadOnlyStreamWrapperTest.php
index d1128c4..628b5d3 100644
--- a/core/modules/system/src/Tests/File/ReadOnlyStreamWrapperTest.php
+++ b/core/tests/Drupal/KernelTests/Core/File/ReadOnlyStreamWrapperTest.php
@@ -1,6 +1,6 @@
 <?php
 
-namespace Drupal\system\Tests\File;
+namespace Drupal\KernelTests\Core\File;
 
 /**
  * Tests the read-only stream wrapper write functions.
diff --git a/core/modules/system/src/Tests/File/RemoteFileDirectoryTest.php b/core/tests/Drupal/KernelTests/Core/File/RemoteFileDirectoryTest.php
similarity index 94%
rename from core/modules/system/src/Tests/File/RemoteFileDirectoryTest.php
rename to core/tests/Drupal/KernelTests/Core/File/RemoteFileDirectoryTest.php
index 7c286fe..3265562 100644
--- a/core/modules/system/src/Tests/File/RemoteFileDirectoryTest.php
+++ b/core/tests/Drupal/KernelTests/Core/File/RemoteFileDirectoryTest.php
@@ -1,6 +1,6 @@
 <?php
 
-namespace Drupal\system\Tests\File;
+namespace Drupal\KernelTests\Core\File;
 
 /**
  * Tests operations dealing with directories.
diff --git a/core/modules/system/src/Tests/File/RemoteFileScanDirectoryTest.php b/core/tests/Drupal/KernelTests/Core/File/RemoteFileScanDirectoryTest.php
similarity index 94%
rename from core/modules/system/src/Tests/File/RemoteFileScanDirectoryTest.php
rename to core/tests/Drupal/KernelTests/Core/File/RemoteFileScanDirectoryTest.php
index 8b30aba..3d872bc 100644
--- a/core/modules/system/src/Tests/File/RemoteFileScanDirectoryTest.php
+++ b/core/tests/Drupal/KernelTests/Core/File/RemoteFileScanDirectoryTest.php
@@ -1,6 +1,6 @@
 <?php
 
-namespace Drupal\system\Tests\File;
+namespace Drupal\KernelTests\Core\File;
 
 /**
  * Tests the file_scan_directory() function.
diff --git a/core/modules/system/src/Tests/File/RemoteFileUnmanagedCopyTest.php b/core/tests/Drupal/KernelTests/Core/File/RemoteFileUnmanagedCopyTest.php
similarity index 94%
rename from core/modules/system/src/Tests/File/RemoteFileUnmanagedCopyTest.php
rename to core/tests/Drupal/KernelTests/Core/File/RemoteFileUnmanagedCopyTest.php
index 9c6c0d6..8be6726 100644
--- a/core/modules/system/src/Tests/File/RemoteFileUnmanagedCopyTest.php
+++ b/core/tests/Drupal/KernelTests/Core/File/RemoteFileUnmanagedCopyTest.php
@@ -1,6 +1,6 @@
 <?php
 
-namespace Drupal\system\Tests\File;
+namespace Drupal\KernelTests\Core\File;
 
 /**
  * Tests the unmanaged file copy function.
diff --git a/core/modules/system/src/Tests/File/RemoteFileUnmanagedDeleteRecursiveTest.php b/core/tests/Drupal/KernelTests/Core/File/RemoteFileUnmanagedDeleteRecursiveTest.php
similarity index 94%
rename from core/modules/system/src/Tests/File/RemoteFileUnmanagedDeleteRecursiveTest.php
rename to core/tests/Drupal/KernelTests/Core/File/RemoteFileUnmanagedDeleteRecursiveTest.php
index 7c47526..06f0e1a 100644
--- a/core/modules/system/src/Tests/File/RemoteFileUnmanagedDeleteRecursiveTest.php
+++ b/core/tests/Drupal/KernelTests/Core/File/RemoteFileUnmanagedDeleteRecursiveTest.php
@@ -1,6 +1,6 @@
 <?php
 
-namespace Drupal\system\Tests\File;
+namespace Drupal\KernelTests\Core\File;
 
 /**
  * Tests the unmanaged file delete recursive function.
diff --git a/core/modules/system/src/Tests/File/RemoteFileUnmanagedDeleteTest.php b/core/tests/Drupal/KernelTests/Core/File/RemoteFileUnmanagedDeleteTest.php
similarity index 94%
rename from core/modules/system/src/Tests/File/RemoteFileUnmanagedDeleteTest.php
rename to core/tests/Drupal/KernelTests/Core/File/RemoteFileUnmanagedDeleteTest.php
index d628bee..fe0ad6e 100644
--- a/core/modules/system/src/Tests/File/RemoteFileUnmanagedDeleteTest.php
+++ b/core/tests/Drupal/KernelTests/Core/File/RemoteFileUnmanagedDeleteTest.php
@@ -1,6 +1,6 @@
 <?php
 
-namespace Drupal\system\Tests\File;
+namespace Drupal\KernelTests\Core\File;
 
 /**
  * Tests the unmanaged file delete function.
diff --git a/core/modules/system/src/Tests/File/RemoteFileUnmanagedMoveTest.php b/core/tests/Drupal/KernelTests/Core/File/RemoteFileUnmanagedMoveTest.php
similarity index 94%
rename from core/modules/system/src/Tests/File/RemoteFileUnmanagedMoveTest.php
rename to core/tests/Drupal/KernelTests/Core/File/RemoteFileUnmanagedMoveTest.php
index ee3ef7f..47b66f2 100644
--- a/core/modules/system/src/Tests/File/RemoteFileUnmanagedMoveTest.php
+++ b/core/tests/Drupal/KernelTests/Core/File/RemoteFileUnmanagedMoveTest.php
@@ -1,6 +1,6 @@
 <?php
 
-namespace Drupal\system\Tests\File;
+namespace Drupal\KernelTests\Core\File;
 
 /**
  * Tests the unmanaged file move function.
diff --git a/core/modules/system/src/Tests/File/RemoteFileUnmanagedSaveDataTest.php b/core/tests/Drupal/KernelTests/Core/File/RemoteFileUnmanagedSaveDataTest.php
similarity index 94%
rename from core/modules/system/src/Tests/File/RemoteFileUnmanagedSaveDataTest.php
rename to core/tests/Drupal/KernelTests/Core/File/RemoteFileUnmanagedSaveDataTest.php
index 2af252a..15b5929 100644
--- a/core/modules/system/src/Tests/File/RemoteFileUnmanagedSaveDataTest.php
+++ b/core/tests/Drupal/KernelTests/Core/File/RemoteFileUnmanagedSaveDataTest.php
@@ -1,6 +1,6 @@
 <?php
 
-namespace Drupal\system\Tests\File;
+namespace Drupal\KernelTests\Core\File;
 
 /**
  * Tests the unmanaged file save data function.
diff --git a/core/modules/system/src/Tests/File/ScanDirectoryTest.php b/core/tests/Drupal/KernelTests/Core/File/ScanDirectoryTest.php
similarity index 99%
rename from core/modules/system/src/Tests/File/ScanDirectoryTest.php
rename to core/tests/Drupal/KernelTests/Core/File/ScanDirectoryTest.php
index d372671..2e753f6 100644
--- a/core/modules/system/src/Tests/File/ScanDirectoryTest.php
+++ b/core/tests/Drupal/KernelTests/Core/File/ScanDirectoryTest.php
@@ -1,6 +1,6 @@
 <?php
 
-namespace Drupal\system\Tests\File;
+namespace Drupal\KernelTests\Core\File;
 
 /**
  * Tests the file_scan_directory() function.
diff --git a/core/modules/system/src/Tests/File/StreamWrapperTest.php b/core/tests/Drupal/KernelTests/Core/File/StreamWrapperTest.php
similarity index 97%
rename from core/modules/system/src/Tests/File/StreamWrapperTest.php
rename to core/tests/Drupal/KernelTests/Core/File/StreamWrapperTest.php
index 9524388..e9c8642 100644
--- a/core/modules/system/src/Tests/File/StreamWrapperTest.php
+++ b/core/tests/Drupal/KernelTests/Core/File/StreamWrapperTest.php
@@ -1,6 +1,6 @@
 <?php
 
-namespace Drupal\system\Tests\File;
+namespace Drupal\KernelTests\Core\File;
 
 use Drupal\Core\DrupalKernel;
 use Drupal\Core\Site\Settings;
@@ -36,14 +36,12 @@ class StreamWrapperTest extends FileTestBase {
   protected $classname = 'Drupal\file_test\StreamWrapper\DummyStreamWrapper';
 
   function setUp() {
+    parent::setUp();
+
     // Add file_private_path setting.
-    $settings = Settings::getAll();
     $request = Request::create('/');;
     $site_path = DrupalKernel::findSitePath($request);
-    $settings['file_private_path'] = $site_path . '/private';
-    new Settings($settings + Settings::getAll());
-
-    parent::setUp();
+    $this->setSetting('file_private_path', $site_path . '/private');
   }
 
   /**
diff --git a/core/modules/system/src/Tests/File/UnmanagedCopyTest.php b/core/tests/Drupal/KernelTests/Core/File/UnmanagedCopyTest.php
similarity index 99%
rename from core/modules/system/src/Tests/File/UnmanagedCopyTest.php
rename to core/tests/Drupal/KernelTests/Core/File/UnmanagedCopyTest.php
index 97a8b4c..6b2fbed 100644
--- a/core/modules/system/src/Tests/File/UnmanagedCopyTest.php
+++ b/core/tests/Drupal/KernelTests/Core/File/UnmanagedCopyTest.php
@@ -1,6 +1,6 @@
 <?php
 
-namespace Drupal\system\Tests\File;
+namespace Drupal\KernelTests\Core\File;
 
 use Drupal\Core\Site\Settings;
 use Drupal\Core\File\FileSystem;
diff --git a/core/modules/system/src/Tests/File/UnmanagedDeleteRecursiveTest.php b/core/tests/Drupal/KernelTests/Core/File/UnmanagedDeleteRecursiveTest.php
similarity index 98%
rename from core/modules/system/src/Tests/File/UnmanagedDeleteRecursiveTest.php
rename to core/tests/Drupal/KernelTests/Core/File/UnmanagedDeleteRecursiveTest.php
index b8c33e0..feed31b 100644
--- a/core/modules/system/src/Tests/File/UnmanagedDeleteRecursiveTest.php
+++ b/core/tests/Drupal/KernelTests/Core/File/UnmanagedDeleteRecursiveTest.php
@@ -1,6 +1,6 @@
 <?php
 
-namespace Drupal\system\Tests\File;
+namespace Drupal\KernelTests\Core\File;
 
 /**
  * Tests the unmanaged file delete recursive function.
diff --git a/core/modules/system/src/Tests/File/UnmanagedDeleteTest.php b/core/tests/Drupal/KernelTests/Core/File/UnmanagedDeleteTest.php
similarity index 96%
rename from core/modules/system/src/Tests/File/UnmanagedDeleteTest.php
rename to core/tests/Drupal/KernelTests/Core/File/UnmanagedDeleteTest.php
index d93e213..55e4536 100644
--- a/core/modules/system/src/Tests/File/UnmanagedDeleteTest.php
+++ b/core/tests/Drupal/KernelTests/Core/File/UnmanagedDeleteTest.php
@@ -1,6 +1,6 @@
 <?php
 
-namespace Drupal\system\Tests\File;
+namespace Drupal\KernelTests\Core\File;
 
 /**
  * Tests the unmanaged file delete function.
diff --git a/core/modules/system/src/Tests/File/UnmanagedMoveTest.php b/core/tests/Drupal/KernelTests/Core/File/UnmanagedMoveTest.php
similarity index 98%
rename from core/modules/system/src/Tests/File/UnmanagedMoveTest.php
rename to core/tests/Drupal/KernelTests/Core/File/UnmanagedMoveTest.php
index 562ab5f..87a29f4 100644
--- a/core/modules/system/src/Tests/File/UnmanagedMoveTest.php
+++ b/core/tests/Drupal/KernelTests/Core/File/UnmanagedMoveTest.php
@@ -1,6 +1,6 @@
 <?php
 
-namespace Drupal\system\Tests\File;
+namespace Drupal\KernelTests\Core\File;
 
 use Drupal\Core\Site\Settings;
 use Drupal\Core\File\FileSystem;
diff --git a/core/modules/system/src/Tests/File/UnmanagedSaveDataTest.php b/core/tests/Drupal/KernelTests/Core/File/UnmanagedSaveDataTest.php
similarity index 92%
rename from core/modules/system/src/Tests/File/UnmanagedSaveDataTest.php
rename to core/tests/Drupal/KernelTests/Core/File/UnmanagedSaveDataTest.php
index 7b869f8..dc06d2c 100644
--- a/core/modules/system/src/Tests/File/UnmanagedSaveDataTest.php
+++ b/core/tests/Drupal/KernelTests/Core/File/UnmanagedSaveDataTest.php
@@ -1,6 +1,6 @@
 <?php
 
-namespace Drupal\system\Tests\File;
+namespace Drupal\KernelTests\Core\File;
 
 /**
  * Tests the file_unmanaged_save_data() function.
@@ -13,7 +13,7 @@ class UnmanagedSaveDataTest extends FileTestBase {
    */
   function testFileSaveData() {
     $contents = $this->randomMachineName(8);
-    $this->settingsSet('file_chmod_file', 0777);
+    $this->setSetting('file_chmod_file', 0777);
 
     // No filename.
     $filepath = file_unmanaged_save_data($contents);
diff --git a/core/modules/system/src/Tests/File/UrlRewritingTest.php b/core/tests/Drupal/KernelTests/Core/File/UrlRewritingTest.php
similarity index 99%
rename from core/modules/system/src/Tests/File/UrlRewritingTest.php
rename to core/tests/Drupal/KernelTests/Core/File/UrlRewritingTest.php
index 5930011..5494975 100644
--- a/core/modules/system/src/Tests/File/UrlRewritingTest.php
+++ b/core/tests/Drupal/KernelTests/Core/File/UrlRewritingTest.php
@@ -1,6 +1,6 @@
 <?php
 
-namespace Drupal\system\Tests\File;
+namespace Drupal\KernelTests\Core\File;
 
 use Symfony\Component\HttpFoundation\Request;
 
diff --git a/core/modules/system/src/Tests/Form/ExternalFormUrlTest.php b/core/tests/Drupal/KernelTests/Core/Form/ExternalFormUrlTest.php
similarity index 91%
rename from core/modules/system/src/Tests/Form/ExternalFormUrlTest.php
rename to core/tests/Drupal/KernelTests/Core/Form/ExternalFormUrlTest.php
index d1ef9ff..f3fbc4f 100644
--- a/core/modules/system/src/Tests/Form/ExternalFormUrlTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Form/ExternalFormUrlTest.php
@@ -1,10 +1,10 @@
 <?php
 
-namespace Drupal\system\Tests\Form;
+namespace Drupal\KernelTests\Core\Form;
 
 use Drupal\Core\Form\FormInterface;
 use Drupal\Core\Form\FormStateInterface;
-use Drupal\simpletest\KernelTestBase;
+use Drupal\KernelTests\KernelTestBase;
 use Drupal\user\Entity\User;
 use Symfony\Component\HttpFoundation\Request;
 
@@ -62,7 +62,6 @@ protected function setUp() {
     ]);
     $test_user->save();
     \Drupal::service('current_user')->setAccount($test_user);
-
   }
 
   /**
@@ -72,7 +71,11 @@ public function testActionUrlBehavior() {
     // Create a new request which has a request uri with multiple leading
     // slashes and make it the master request.
     $request_stack = \Drupal::service('request_stack');
+    /** @var \Symfony\Component\HttpFoundation\RequestStack $original_request */
     $original_request = $request_stack->pop();
+    // Just request some more so there is no request left.
+    $request_stack->pop();
+    $request_stack->pop();
     $request = Request::create($original_request->getSchemeAndHttpHost() . '//example.org');
     $request_stack->push($request);
 
diff --git a/core/modules/system/src/Tests/Form/FormCacheTest.php b/core/tests/Drupal/KernelTests/Core/Form/FormCacheTest.php
similarity index 97%
rename from core/modules/system/src/Tests/Form/FormCacheTest.php
rename to core/tests/Drupal/KernelTests/Core/Form/FormCacheTest.php
index 0584621..fa86bee 100644
--- a/core/modules/system/src/Tests/Form/FormCacheTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Form/FormCacheTest.php
@@ -1,11 +1,11 @@
 <?php
 
-namespace Drupal\system\Tests\Form;
+namespace Drupal\KernelTests\Core\Form;
 
 use Drupal\Core\Form\FormState;
 use Drupal\Core\Session\AnonymousUserSession;
 use Drupal\Core\Session\UserSession;
-use Drupal\simpletest\KernelTestBase;
+use Drupal\KernelTests\KernelTestBase;
 
 /**
  * Tests \Drupal::formBuilder()->setCache() and
diff --git a/core/modules/system/src/Tests/Form/FormDefaultHandlersTest.php b/core/tests/Drupal/KernelTests/Core/Form/FormDefaultHandlersTest.php
similarity index 97%
rename from core/modules/system/src/Tests/Form/FormDefaultHandlersTest.php
rename to core/tests/Drupal/KernelTests/Core/Form/FormDefaultHandlersTest.php
index 5322b7c..7f046e9 100644
--- a/core/modules/system/src/Tests/Form/FormDefaultHandlersTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Form/FormDefaultHandlersTest.php
@@ -1,11 +1,11 @@
 <?php
 
-namespace Drupal\system\Tests\Form;
+namespace Drupal\KernelTests\Core\Form;
 
 use Drupal\Core\Form\FormInterface;
 use Drupal\Core\Form\FormState;
 use Drupal\Core\Form\FormStateInterface;
-use Drupal\simpletest\KernelTestBase;
+use Drupal\KernelTests\KernelTestBase;
 
 /**
  * Tests automatically added form handlers.
diff --git a/core/modules/system/src/Tests/Form/TriggeringElementProgrammedUnitTest.php b/core/tests/Drupal/KernelTests/Core/Form/TriggeringElementProgrammedTest.php
similarity index 91%
rename from core/modules/system/src/Tests/Form/TriggeringElementProgrammedUnitTest.php
rename to core/tests/Drupal/KernelTests/Core/Form/TriggeringElementProgrammedTest.php
index 5f2a589..c24d47e 100644
--- a/core/modules/system/src/Tests/Form/TriggeringElementProgrammedUnitTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Form/TriggeringElementProgrammedTest.php
@@ -1,20 +1,18 @@
 <?php
 
-namespace Drupal\system\Tests\Form;
+namespace Drupal\KernelTests\Core\Form;
 
 use Drupal\Core\Form\FormInterface;
 use Drupal\Core\Form\FormState;
 use Drupal\Core\Form\FormStateInterface;
-use Drupal\simpletest\KernelTestBase;
+use Drupal\KernelTests\KernelTestBase;
 
 /**
  * Tests detection of triggering_element for programmed form submissions.
  *
  * @group Form
  */
-class TriggeringElementProgrammedUnitTest extends KernelTestBase implements FormInterface {
-
-  public static $modules = array('system');
+class TriggeringElementProgrammedTest extends KernelTestBase implements FormInterface {
 
   /**
    * {@inheritdoc}
diff --git a/core/modules/system/src/Tests/HttpKernel/StackKernelIntegrationTest.php b/core/tests/Drupal/KernelTests/Core/HttpKernel/StackKernelIntegrationTest.php
similarity index 94%
rename from core/modules/system/src/Tests/HttpKernel/StackKernelIntegrationTest.php
rename to core/tests/Drupal/KernelTests/Core/HttpKernel/StackKernelIntegrationTest.php
index 1d6f769..166ec24 100644
--- a/core/modules/system/src/Tests/HttpKernel/StackKernelIntegrationTest.php
+++ b/core/tests/Drupal/KernelTests/Core/HttpKernel/StackKernelIntegrationTest.php
@@ -1,9 +1,9 @@
 <?php
 
-namespace Drupal\system\Tests\HttpKernel;
+namespace Drupal\KernelTests\Core\HttpKernel;
 
-use Drupal\simpletest\KernelTestBase;
 use Drupal\Core\Url;
+use Drupal\KernelTests\KernelTestBase;
 use Symfony\Component\HttpFoundation\Request;
 use Symfony\Component\HttpKernel\HttpKernelInterface;
 
@@ -52,7 +52,7 @@ public function testLazyLateMiddlewares() {
     $this->assertFalse($this->container->getDefinition('http_kernel.basic')->isLazy(), 'lazy flag on http_kernel.basic definition is not set');
 
     \Drupal::service('module_installer')->install(['page_cache']);
-    $this->container = $this->kernel->rebuildContainer();
+    $this->container = \Drupal::service('kernel')->rebuildContainer();
 
     $this->assertFalse($this->container->getDefinition('http_middleware.reverse_proxy')->isLazy(), 'lazy flag on http_middleware.reverse_proxy definition is not set');
     $this->assertFalse($this->container->getDefinition('http_middleware.page_cache')->isLazy(), 'lazy flag on http_middleware.page_cache definition is not set');
diff --git a/core/modules/system/src/Tests/Image/ToolkitGdTest.php b/core/tests/Drupal/KernelTests/Core/Image/ToolkitGdTest.php
similarity index 98%
rename from core/modules/system/src/Tests/Image/ToolkitGdTest.php
rename to core/tests/Drupal/KernelTests/Core/Image/ToolkitGdTest.php
index cb87374..6a10cfc 100644
--- a/core/modules/system/src/Tests/Image/ToolkitGdTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Image/ToolkitGdTest.php
@@ -1,10 +1,11 @@
 <?php
 
-namespace Drupal\system\Tests\Image;
+namespace Drupal\KernelTests\Core\Image;
 
 use Drupal\Core\Image\ImageInterface;
 use Drupal\Component\Utility\SafeMarkup;
-use Drupal\simpletest\KernelTestBase;
+use Drupal\Core\Site\Settings;
+use Drupal\KernelTests\KernelTestBase;
 
 /**
  * Tests that core image manipulations work properly: scale, resize, rotate,
@@ -248,7 +249,7 @@ function testManipulations() {
     }
 
     // Prepare a directory for test file results.
-    $directory = $this->publicFilesDirectory . '/imagetest';
+    $directory = Settings::get('file_public_path') . '/imagetest';
     file_prepare_directory($directory, FILE_CREATE_DIRECTORY);
 
     foreach ($files as $file) {
@@ -424,7 +425,7 @@ public function testResourceDestruction() {
    */
   function testGifTransparentImages() {
     // Prepare a directory for test file results.
-    $directory = $this->publicFilesDirectory . '/imagetest';
+    $directory = Settings::get('file_public_path') . '/imagetest';
     file_prepare_directory($directory, FILE_CREATE_DIRECTORY);
 
     // Test loading an indexed GIF image with transparent color set.
diff --git a/core/modules/system/src/Tests/Installer/InstallerLanguageTest.php b/core/tests/Drupal/KernelTests/Core/Installer/InstallerLanguageTest.php
similarity index 96%
rename from core/modules/system/src/Tests/Installer/InstallerLanguageTest.php
rename to core/tests/Drupal/KernelTests/Core/Installer/InstallerLanguageTest.php
index ca2ea0c..060ee46 100644
--- a/core/modules/system/src/Tests/Installer/InstallerLanguageTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Installer/InstallerLanguageTest.php
@@ -1,9 +1,9 @@
 <?php
 
-namespace Drupal\system\Tests\Installer;
+namespace Drupal\KernelTests\Core\Installer;
 
-use Drupal\simpletest\KernelTestBase;
 use Drupal\Core\StringTranslation\Translator\FileTranslation;
+use Drupal\KernelTests\KernelTestBase;
 
 /**
  * Tests for installer language support.
diff --git a/core/modules/system/src/Tests/KeyValueStore/DatabaseStorageExpirableTest.php b/core/tests/Drupal/KernelTests/Core/KeyValueStore/DatabaseStorageExpirableTest.php
similarity index 97%
rename from core/modules/system/src/Tests/KeyValueStore/DatabaseStorageExpirableTest.php
rename to core/tests/Drupal/KernelTests/Core/KeyValueStore/DatabaseStorageExpirableTest.php
index ff31f33..1631501 100644
--- a/core/modules/system/src/Tests/KeyValueStore/DatabaseStorageExpirableTest.php
+++ b/core/tests/Drupal/KernelTests/Core/KeyValueStore/DatabaseStorageExpirableTest.php
@@ -1,6 +1,6 @@
 <?php
 
-namespace Drupal\system\Tests\KeyValueStore;
+namespace Drupal\KernelTests\Core\KeyValueStore;
 
 use Drupal\Core\DependencyInjection\ContainerBuilder;
 use Drupal\Core\KeyValueStore\KeyValueFactory;
@@ -28,8 +28,8 @@ protected function setUp() {
   /**
    * {@inheritdoc}
    */
-  public function containerBuild(ContainerBuilder $container) {
-    parent::containerBuild($container);
+  public function register(ContainerBuilder $container) {
+    parent::register($container);
 
     $parameter[KeyValueFactory::DEFAULT_SETTING] = 'keyvalue.expirable.database';
     $container->setParameter('factory.keyvalue.expirable', $parameter);
diff --git a/core/modules/system/src/Tests/KeyValueStore/DatabaseStorageTest.php b/core/tests/Drupal/KernelTests/Core/KeyValueStore/DatabaseStorageTest.php
similarity index 80%
rename from core/modules/system/src/Tests/KeyValueStore/DatabaseStorageTest.php
rename to core/tests/Drupal/KernelTests/Core/KeyValueStore/DatabaseStorageTest.php
index b433ac1..676ab10 100644
--- a/core/modules/system/src/Tests/KeyValueStore/DatabaseStorageTest.php
+++ b/core/tests/Drupal/KernelTests/Core/KeyValueStore/DatabaseStorageTest.php
@@ -1,6 +1,6 @@
 <?php
 
-namespace Drupal\system\Tests\KeyValueStore;
+namespace Drupal\KernelTests\Core\KeyValueStore;
 
 use Drupal\Core\DependencyInjection\ContainerBuilder;
 use Drupal\Core\KeyValueStore\KeyValueFactory;
@@ -27,8 +27,8 @@ protected function setUp() {
   /**
    * {@inheritdoc}
    */
-  public function containerBuild(ContainerBuilder $container) {
-    parent::containerBuild($container);
+  public function register(ContainerBuilder $container) {
+    parent::register($container);
 
     $parameter[KeyValueFactory::DEFAULT_SETTING] = 'keyvalue.database';
     $container->setParameter('factory.keyvalue', $parameter);
diff --git a/core/modules/system/src/Tests/KeyValueStore/GarbageCollectionTest.php b/core/tests/Drupal/KernelTests/Core/KeyValueStore/GarbageCollectionTest.php
similarity index 95%
rename from core/modules/system/src/Tests/KeyValueStore/GarbageCollectionTest.php
rename to core/tests/Drupal/KernelTests/Core/KeyValueStore/GarbageCollectionTest.php
index 46a99ab..4dc9b47 100644
--- a/core/modules/system/src/Tests/KeyValueStore/GarbageCollectionTest.php
+++ b/core/tests/Drupal/KernelTests/Core/KeyValueStore/GarbageCollectionTest.php
@@ -1,11 +1,11 @@
 <?php
 
-namespace Drupal\system\Tests\KeyValueStore;
+namespace Drupal\KernelTests\Core\KeyValueStore;
 
 use Drupal\Component\Serialization\PhpSerialize;
 use Drupal\Core\Database\Database;
 use Drupal\Core\KeyValueStore\DatabaseStorageExpirable;
-use Drupal\simpletest\KernelTestBase;
+use Drupal\KernelTests\KernelTestBase;
 
 /**
  * Tests garbage collection for the expirable key-value database storage.
diff --git a/core/modules/system/src/Tests/KeyValueStore/KeyValueContentEntityStorageTest.php b/core/tests/Drupal/KernelTests/Core/KeyValueStore/KeyValueContentEntityStorageTest.php
similarity index 99%
rename from core/modules/system/src/Tests/KeyValueStore/KeyValueContentEntityStorageTest.php
rename to core/tests/Drupal/KernelTests/Core/KeyValueStore/KeyValueContentEntityStorageTest.php
index 8161163..068216b 100644
--- a/core/modules/system/src/Tests/KeyValueStore/KeyValueContentEntityStorageTest.php
+++ b/core/tests/Drupal/KernelTests/Core/KeyValueStore/KeyValueContentEntityStorageTest.php
@@ -1,6 +1,6 @@
 <?php
 
-namespace Drupal\system\Tests\KeyValueStore;
+namespace Drupal\KernelTests\Core\KeyValueStore;
 
 use Drupal\Core\Entity\EntityMalformedException;
 use Drupal\Core\Entity\EntityStorageException;
diff --git a/core/modules/system/src/Tests/KeyValueStore/MemoryStorageTest.php b/core/tests/Drupal/KernelTests/Core/KeyValueStore/MemoryStorageTest.php
similarity index 77%
rename from core/modules/system/src/Tests/KeyValueStore/MemoryStorageTest.php
rename to core/tests/Drupal/KernelTests/Core/KeyValueStore/MemoryStorageTest.php
index 5c149ef..f0f7642 100644
--- a/core/modules/system/src/Tests/KeyValueStore/MemoryStorageTest.php
+++ b/core/tests/Drupal/KernelTests/Core/KeyValueStore/MemoryStorageTest.php
@@ -1,6 +1,6 @@
 <?php
 
-namespace Drupal\system\Tests\KeyValueStore;
+namespace Drupal\KernelTests\Core\KeyValueStore;
 
 use Drupal\Core\DependencyInjection\ContainerBuilder;
 use Drupal\Core\KeyValueStore\KeyValueFactory;
@@ -15,8 +15,8 @@ class MemoryStorageTest extends StorageTestBase {
   /**
    * {@inheritdoc}
    */
-  public function containerBuild(ContainerBuilder $container) {
-    parent::containerBuild($container);
+  public function register(ContainerBuilder $container) {
+    parent::register($container);
 
     $container->register('keyvalue.memory', 'Drupal\Core\KeyValueStore\KeyValueMemoryFactory');
     $parameter[KeyValueFactory::DEFAULT_SETTING] = 'keyvalue.memory';
diff --git a/core/modules/system/src/Tests/KeyValueStore/StorageTestBase.php b/core/tests/Drupal/KernelTests/Core/KeyValueStore/StorageTestBase.php
similarity index 98%
rename from core/modules/system/src/Tests/KeyValueStore/StorageTestBase.php
rename to core/tests/Drupal/KernelTests/Core/KeyValueStore/StorageTestBase.php
index 807d087..48e047d 100644
--- a/core/modules/system/src/Tests/KeyValueStore/StorageTestBase.php
+++ b/core/tests/Drupal/KernelTests/Core/KeyValueStore/StorageTestBase.php
@@ -1,8 +1,8 @@
 <?php
 
-namespace Drupal\system\Tests\KeyValueStore;
+namespace Drupal\KernelTests\Core\KeyValueStore;
 
-use Drupal\simpletest\KernelTestBase;
+use Drupal\KernelTests\KernelTestBase;
 
 /**
  * Base class for testing key-value storages.
diff --git a/core/modules/system/src/Tests/Lock/LockUnitTest.php b/core/tests/Drupal/KernelTests/Core/Lock/LockTest.php
similarity index 94%
rename from core/modules/system/src/Tests/Lock/LockUnitTest.php
rename to core/tests/Drupal/KernelTests/Core/Lock/LockTest.php
index fc3b341..0bd761f 100644
--- a/core/modules/system/src/Tests/Lock/LockUnitTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Lock/LockTest.php
@@ -1,16 +1,16 @@
 <?php
 
-namespace Drupal\system\Tests\Lock;
+namespace Drupal\KernelTests\Core\Lock;
 
 use Drupal\Core\Lock\DatabaseLockBackend;
-use Drupal\simpletest\KernelTestBase;
+use Drupal\KernelTests\KernelTestBase;
 
 /**
  * Tests the Database lock backend.
  *
  * @group Lock
  */
-class LockUnitTest extends KernelTestBase {
+class LockTest extends KernelTestBase {
 
   /**
    * Database lock backend to test.
diff --git a/core/modules/system/src/Tests/Menu/MenuLinkDefaultIntegrationTest.php b/core/tests/Drupal/KernelTests/Core/Menu/MenuLinkDefaultIntegrationTest.php
similarity index 95%
rename from core/modules/system/src/Tests/Menu/MenuLinkDefaultIntegrationTest.php
rename to core/tests/Drupal/KernelTests/Core/Menu/MenuLinkDefaultIntegrationTest.php
index 9935dfc..b999887 100644
--- a/core/modules/system/src/Tests/Menu/MenuLinkDefaultIntegrationTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Menu/MenuLinkDefaultIntegrationTest.php
@@ -1,9 +1,9 @@
 <?php
 
-namespace Drupal\system\Tests\Menu;
+namespace Drupal\KernelTests\Core\Menu;
 
 use Drupal\Core\Menu\MenuTreeParameters;
-use Drupal\simpletest\KernelTestBase;
+use Drupal\KernelTests\KernelTestBase;
 
 /**
  * Tests integration of static menu links.
@@ -18,7 +18,6 @@ class MenuLinkDefaultIntegrationTest extends KernelTestBase {
    * @var array
    */
   public static $modules = array(
-    'system',
     'menu_test',
   );
 
diff --git a/core/modules/system/src/Tests/Menu/MenuLinkTreeTest.php b/core/tests/Drupal/KernelTests/Core/Menu/MenuLinkTreeTest.php
similarity index 98%
rename from core/modules/system/src/Tests/Menu/MenuLinkTreeTest.php
rename to core/tests/Drupal/KernelTests/Core/Menu/MenuLinkTreeTest.php
index 1be1153..0cdc303 100644
--- a/core/modules/system/src/Tests/Menu/MenuLinkTreeTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Menu/MenuLinkTreeTest.php
@@ -1,10 +1,10 @@
 <?php
 
-namespace Drupal\system\Tests\Menu;
+namespace Drupal\KernelTests\Core\Menu;
 
 use Drupal\Core\Menu\MenuLinkTreeElement;
 use Drupal\Core\Menu\MenuTreeParameters;
-use Drupal\simpletest\KernelTestBase;
+use Drupal\KernelTests\KernelTestBase;
 use Drupal\Tests\Core\Menu\MenuLinkMock;
 
 /**
diff --git a/core/modules/system/src/Tests/Menu/MenuTreeStorageTest.php b/core/tests/Drupal/KernelTests/Core/Menu/MenuTreeStorageTest.php
similarity index 99%
rename from core/modules/system/src/Tests/Menu/MenuTreeStorageTest.php
rename to core/tests/Drupal/KernelTests/Core/Menu/MenuTreeStorageTest.php
index 66df4dd..cb1d74d 100644
--- a/core/modules/system/src/Tests/Menu/MenuTreeStorageTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Menu/MenuTreeStorageTest.php
@@ -1,11 +1,11 @@
 <?php
 
-namespace Drupal\system\Tests\Menu;
+namespace Drupal\KernelTests\Core\Menu;
 
 use Drupal\Component\Plugin\Exception\PluginException;
 use Drupal\Core\Menu\MenuTreeParameters;
 use Drupal\Core\Menu\MenuTreeStorage;
-use Drupal\simpletest\KernelTestBase;
+use Drupal\KernelTests\KernelTestBase;
 
 /**
  * Tests the menu tree storage.
@@ -31,13 +31,6 @@ class MenuTreeStorageTest extends KernelTestBase {
   protected $connection;
 
   /**
-   * Modules to enable.
-   *
-   * @var array
-   */
-  public static $modules = array('system');
-
-  /**
    * {@inheritdoc}
    */
   protected function setUp() {
diff --git a/core/modules/system/src/Tests/Path/AliasTest.php b/core/tests/Drupal/KernelTests/Core/Path/AliasTest.php
similarity index 99%
rename from core/modules/system/src/Tests/Path/AliasTest.php
rename to core/tests/Drupal/KernelTests/Core/Path/AliasTest.php
index 4ef3b94..5eb2ace 100644
--- a/core/modules/system/src/Tests/Path/AliasTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Path/AliasTest.php
@@ -1,6 +1,6 @@
 <?php
 
-namespace Drupal\system\Tests\Path;
+namespace Drupal\KernelTests\Core\Path;
 
 use Drupal\Core\Cache\MemoryCounterBackend;
 use Drupal\Core\Path\AliasStorage;
diff --git a/core/modules/system/src/Tests/Path/PathUnitTestBase.php b/core/tests/Drupal/KernelTests/Core/Path/PathUnitTestBase.php
similarity index 83%
rename from core/modules/system/src/Tests/Path/PathUnitTestBase.php
rename to core/tests/Drupal/KernelTests/Core/Path/PathUnitTestBase.php
index b245b0e..9c50f9a 100644
--- a/core/modules/system/src/Tests/Path/PathUnitTestBase.php
+++ b/core/tests/Drupal/KernelTests/Core/Path/PathUnitTestBase.php
@@ -1,9 +1,10 @@
 <?php
 
-namespace Drupal\system\Tests\Path;
+namespace Drupal\KernelTests\Core\Path;
 
-use Drupal\simpletest\KernelTestBase;
 use Drupal\Core\Database\Database;
+use Drupal\KernelTests\KernelTestBase;
+use Drupal\system\Tests\Path\UrlAliasFixtures;
 
 /**
  * Base class for Path/URL alias integration tests.
diff --git a/core/modules/system/tests/modules/condition_test/src/Tests/ConditionTestDualUserTest.php b/core/tests/Drupal/KernelTests/Core/Plugin/Condition/ConditionTestDualUserTest.php
similarity index 98%
rename from core/modules/system/tests/modules/condition_test/src/Tests/ConditionTestDualUserTest.php
rename to core/tests/Drupal/KernelTests/Core/Plugin/Condition/ConditionTestDualUserTest.php
index c5724e0..5d57d57 100644
--- a/core/modules/system/tests/modules/condition_test/src/Tests/ConditionTestDualUserTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Plugin/Condition/ConditionTestDualUserTest.php
@@ -1,6 +1,6 @@
 <?php
 
-namespace Drupal\condition_test\Tests;
+namespace Drupal\KernelTests\Core\Plugin\Condition;
 
 use Drupal\Core\Plugin\Context\Context;
 use Drupal\Core\Plugin\Context\ContextDefinition;
diff --git a/core/modules/system/src/Tests/Condition/CurrentThemeConditionTest.php b/core/tests/Drupal/KernelTests/Core/Plugin/Condition/CurrentThemeConditionTest.php
similarity index 94%
rename from core/modules/system/src/Tests/Condition/CurrentThemeConditionTest.php
rename to core/tests/Drupal/KernelTests/Core/Plugin/Condition/CurrentThemeConditionTest.php
index 3d3eece..d9a7cb3 100644
--- a/core/modules/system/src/Tests/Condition/CurrentThemeConditionTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Plugin/Condition/CurrentThemeConditionTest.php
@@ -1,9 +1,9 @@
 <?php
 
-namespace Drupal\system\Tests\Condition;
+namespace Drupal\KernelTests\Core\Plugin\Condition;
 
 use Drupal\Component\Utility\SafeMarkup;
-use Drupal\simpletest\KernelTestBase;
+use Drupal\KernelTests\KernelTestBase;
 
 /**
  * Tests the CurrentThemeCondition plugin.
diff --git a/core/modules/system/tests/modules/condition_test/src/Tests/OptionalContextConditionTest.php b/core/tests/Drupal/KernelTests/Core/Plugin/Condition/OptionalContextConditionTest.php
similarity index 90%
rename from core/modules/system/tests/modules/condition_test/src/Tests/OptionalContextConditionTest.php
rename to core/tests/Drupal/KernelTests/Core/Plugin/Condition/OptionalContextConditionTest.php
index 8b15f86..96c8bac 100644
--- a/core/modules/system/tests/modules/condition_test/src/Tests/OptionalContextConditionTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Plugin/Condition/OptionalContextConditionTest.php
@@ -1,12 +1,12 @@
 <?php
 
-namespace Drupal\condition_test\Tests;
+namespace Drupal\KernelTests\Core\Plugin\Condition;
 
 use Drupal\Core\Plugin\Context\Context;
 use Drupal\Core\Plugin\Context\ContextDefinition;
+use Drupal\KernelTests\KernelTestBase;
 use Drupal\node\Entity\Node;
 use Drupal\node\Entity\NodeType;
-use Drupal\simpletest\KernelTestBase;
 
 /**
  * Tests a condition with optional context.
@@ -23,7 +23,7 @@ class OptionalContextConditionTest extends KernelTestBase {
   /**
    * Tests with both contexts mapped to the same user.
    */
-  protected function testContextMissing() {
+  public function testContextMissing() {
     /** @var \Drupal\Core\Condition\ConditionPluginBase $condition */
     $condition = \Drupal::service('plugin.manager.condition')
       ->createInstance('condition_test_optional_context')
@@ -37,7 +37,7 @@ protected function testContextMissing() {
   /**
    * Tests with both contexts mapped to the same user.
    */
-  protected function testContextNoValue() {
+  public function testContextNoValue() {
     /** @var \Drupal\Core\Condition\ConditionPluginBase $condition */
     $condition = \Drupal::service('plugin.manager.condition')
       ->createInstance('condition_test_optional_context')
@@ -53,7 +53,7 @@ protected function testContextNoValue() {
   /**
    * Tests with both contexts mapped to the same user.
    */
-  protected function testContextAvailable() {
+  public function testContextAvailable() {
     NodeType::create(['type' => 'example', 'name' => 'Example'])->save();
     /** @var \Drupal\Core\Condition\ConditionPluginBase $condition */
     $condition = \Drupal::service('plugin.manager.condition')
diff --git a/core/modules/system/src/Tests/Plugin/Condition/RequestPathTest.php b/core/tests/Drupal/KernelTests/Core/Plugin/Condition/RequestPathTest.php
similarity index 98%
rename from core/modules/system/src/Tests/Plugin/Condition/RequestPathTest.php
rename to core/tests/Drupal/KernelTests/Core/Plugin/Condition/RequestPathTest.php
index 6c37dcf..02f2a5d 100644
--- a/core/modules/system/src/Tests/Plugin/Condition/RequestPathTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Plugin/Condition/RequestPathTest.php
@@ -1,9 +1,9 @@
 <?php
 
-namespace Drupal\system\Tests\Plugin\Condition;
+namespace Drupal\KernelTests\Core\Plugin\Condition;
 
 use Drupal\Core\Path\CurrentPathStack;
-use Drupal\simpletest\KernelTestBase;
+use Drupal\KernelTests\KernelTestBase;
 use Drupal\system\Tests\Routing\MockAliasManager;
 use Symfony\Component\HttpFoundation\Request;
 use Symfony\Component\HttpFoundation\RequestStack;
diff --git a/core/modules/system/src/Tests/Plugin/ContextPluginTest.php b/core/tests/Drupal/KernelTests/Core/Plugin/ContextPluginTest.php
similarity index 98%
rename from core/modules/system/src/Tests/Plugin/ContextPluginTest.php
rename to core/tests/Drupal/KernelTests/Core/Plugin/ContextPluginTest.php
index ca36a3b..3c25184 100644
--- a/core/modules/system/src/Tests/Plugin/ContextPluginTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Plugin/ContextPluginTest.php
@@ -1,13 +1,13 @@
 <?php
 
-namespace Drupal\system\Tests\Plugin;
+namespace Drupal\KernelTests\Core\Plugin;
 
 use Drupal\Component\Plugin\Exception\ContextException;
 use Drupal\Core\Plugin\Context\ContextDefinition;
+use Drupal\KernelTests\KernelTestBase;
 use Drupal\node\Entity\Node;
 use Drupal\node\Entity\NodeType;
 use Drupal\plugin_test\Plugin\MockBlockManager;
-use Drupal\simpletest\KernelTestBase;
 use Drupal\user\Entity\User;
 
 /**
diff --git a/core/modules/system/src/Tests/Plugin/DerivativeTest.php b/core/tests/Drupal/KernelTests/Core/Plugin/DerivativeTest.php
similarity index 97%
rename from core/modules/system/src/Tests/Plugin/DerivativeTest.php
rename to core/tests/Drupal/KernelTests/Core/Plugin/DerivativeTest.php
index 1ff5e69..7a834af 100644
--- a/core/modules/system/src/Tests/Plugin/DerivativeTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Plugin/DerivativeTest.php
@@ -1,6 +1,6 @@
 <?php
 
-namespace Drupal\system\Tests\Plugin;
+namespace Drupal\KernelTests\Core\Plugin;
 
 /**
  * Tests that derivative plugins are correctly discovered.
diff --git a/core/modules/system/src/Tests/Plugin/Discovery/AnnotatedClassDiscoveryTest.php b/core/tests/Drupal/KernelTests/Core/Plugin/Discovery/AnnotatedClassDiscoveryTest.php
similarity index 98%
rename from core/modules/system/src/Tests/Plugin/Discovery/AnnotatedClassDiscoveryTest.php
rename to core/tests/Drupal/KernelTests/Core/Plugin/Discovery/AnnotatedClassDiscoveryTest.php
index 3fb45b4..bc68dc1 100644
--- a/core/modules/system/src/Tests/Plugin/Discovery/AnnotatedClassDiscoveryTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Plugin/Discovery/AnnotatedClassDiscoveryTest.php
@@ -1,6 +1,6 @@
 <?php
 
-namespace Drupal\system\Tests\Plugin\Discovery;
+namespace Drupal\KernelTests\Core\Plugin\Discovery;
 
 use Drupal\Core\Plugin\Discovery\AnnotatedClassDiscovery;
 
diff --git a/core/modules/system/src/Tests/Plugin/Discovery/CustomAnnotationClassDiscoveryTest.php b/core/tests/Drupal/KernelTests/Core/Plugin/Discovery/CustomAnnotationClassDiscoveryTest.php
similarity index 96%
rename from core/modules/system/src/Tests/Plugin/Discovery/CustomAnnotationClassDiscoveryTest.php
rename to core/tests/Drupal/KernelTests/Core/Plugin/Discovery/CustomAnnotationClassDiscoveryTest.php
index a8a8656..5cd8f75 100644
--- a/core/modules/system/src/Tests/Plugin/Discovery/CustomAnnotationClassDiscoveryTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Plugin/Discovery/CustomAnnotationClassDiscoveryTest.php
@@ -1,6 +1,6 @@
 <?php
 
-namespace Drupal\system\Tests\Plugin\Discovery;
+namespace Drupal\KernelTests\Core\Plugin\Discovery;
 
 use Drupal\Core\Plugin\Discovery\AnnotatedClassDiscovery;
 
diff --git a/core/modules/system/src/Tests/Plugin/Discovery/CustomDirectoryAnnotatedClassDiscoveryTest.php b/core/tests/Drupal/KernelTests/Core/Plugin/Discovery/CustomDirectoryAnnotatedClassDiscoveryTest.php
similarity index 97%
rename from core/modules/system/src/Tests/Plugin/Discovery/CustomDirectoryAnnotatedClassDiscoveryTest.php
rename to core/tests/Drupal/KernelTests/Core/Plugin/Discovery/CustomDirectoryAnnotatedClassDiscoveryTest.php
index e8e9c78..3d5d8c2 100644
--- a/core/modules/system/src/Tests/Plugin/Discovery/CustomDirectoryAnnotatedClassDiscoveryTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Plugin/Discovery/CustomDirectoryAnnotatedClassDiscoveryTest.php
@@ -1,6 +1,6 @@
 <?php
 
-namespace Drupal\system\Tests\Plugin\Discovery;
+namespace Drupal\KernelTests\Core\Plugin\Discovery;
 
 use Drupal\Core\Plugin\Discovery\AnnotatedClassDiscovery;
 
diff --git a/core/modules/system/src/Tests/Plugin/Discovery/DiscoveryTestBase.php b/core/tests/Drupal/KernelTests/Core/Plugin/Discovery/DiscoveryTestBase.php
similarity index 96%
rename from core/modules/system/src/Tests/Plugin/Discovery/DiscoveryTestBase.php
rename to core/tests/Drupal/KernelTests/Core/Plugin/Discovery/DiscoveryTestBase.php
index d3d4487..bbe2073 100644
--- a/core/modules/system/src/Tests/Plugin/Discovery/DiscoveryTestBase.php
+++ b/core/tests/Drupal/KernelTests/Core/Plugin/Discovery/DiscoveryTestBase.php
@@ -1,9 +1,9 @@
 <?php
 
-namespace Drupal\system\Tests\Plugin\Discovery;
+namespace Drupal\KernelTests\Core\Plugin\Discovery;
 
 use Drupal\Core\StringTranslation\TranslatableMarkup;
-use Drupal\simpletest\KernelTestBase;
+use Drupal\KernelTests\KernelTestBase;
 
 /**
  * Base class for plugin discovery tests.
diff --git a/core/modules/system/src/Tests/Plugin/Discovery/StaticDiscoveryTest.php b/core/tests/Drupal/KernelTests/Core/Plugin/Discovery/StaticDiscoveryTest.php
similarity index 96%
rename from core/modules/system/src/Tests/Plugin/Discovery/StaticDiscoveryTest.php
rename to core/tests/Drupal/KernelTests/Core/Plugin/Discovery/StaticDiscoveryTest.php
index b68f709..bd0c317 100644
--- a/core/modules/system/src/Tests/Plugin/Discovery/StaticDiscoveryTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Plugin/Discovery/StaticDiscoveryTest.php
@@ -1,6 +1,6 @@
 <?php
 
-namespace Drupal\system\Tests\Plugin\Discovery;
+namespace Drupal\KernelTests\Core\Plugin\Discovery;
 
 use Drupal\Component\Plugin\Discovery\StaticDiscovery;
 
diff --git a/core/modules/system/src/Tests/Plugin/FactoryTest.php b/core/tests/Drupal/KernelTests/Core/Plugin/FactoryTest.php
similarity index 98%
rename from core/modules/system/src/Tests/Plugin/FactoryTest.php
rename to core/tests/Drupal/KernelTests/Core/Plugin/FactoryTest.php
index 1cdaf3a..4760990 100644
--- a/core/modules/system/src/Tests/Plugin/FactoryTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Plugin/FactoryTest.php
@@ -1,6 +1,6 @@
 <?php
 
-namespace Drupal\system\Tests\Plugin;
+namespace Drupal\KernelTests\Core\Plugin;
 
 use Drupal\Component\Plugin\Exception\ExceptionInterface;
 
diff --git a/core/modules/system/src/Tests/Plugin/InspectionTest.php b/core/tests/Drupal/KernelTests/Core/Plugin/InspectionTest.php
similarity index 97%
rename from core/modules/system/src/Tests/Plugin/InspectionTest.php
rename to core/tests/Drupal/KernelTests/Core/Plugin/InspectionTest.php
index b1e51cc..4ff9573 100644
--- a/core/modules/system/src/Tests/Plugin/InspectionTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Plugin/InspectionTest.php
@@ -1,6 +1,6 @@
 <?php
 
-namespace Drupal\system\Tests\Plugin;
+namespace Drupal\KernelTests\Core\Plugin;
 
 /**
  * Tests that plugins implementing PluginInspectionInterface are inspectable.
diff --git a/core/modules/system/src/Tests/Plugin/PluginTestBase.php b/core/tests/Drupal/KernelTests/Core/Plugin/PluginTestBase.php
similarity index 98%
rename from core/modules/system/src/Tests/Plugin/PluginTestBase.php
rename to core/tests/Drupal/KernelTests/Core/Plugin/PluginTestBase.php
index 4231cdd..2b70ed4 100644
--- a/core/modules/system/src/Tests/Plugin/PluginTestBase.php
+++ b/core/tests/Drupal/KernelTests/Core/Plugin/PluginTestBase.php
@@ -1,9 +1,9 @@
 <?php
 
-namespace Drupal\system\Tests\Plugin;
+namespace Drupal\KernelTests\Core\Plugin;
 
 use Drupal\Core\Plugin\Context\ContextDefinition;
-use Drupal\simpletest\KernelTestBase;
+use Drupal\KernelTests\KernelTestBase;
 use Drupal\plugin_test\Plugin\TestPluginManager;
 use Drupal\plugin_test\Plugin\MockBlockManager;
 use Drupal\plugin_test\Plugin\DefaultsTestPluginManager;
diff --git a/core/modules/system/src/Tests/Queue/QueueSerializationTest.php b/core/tests/Drupal/KernelTests/Core/Queue/QueueSerializationTest.php
similarity index 96%
rename from core/modules/system/src/Tests/Queue/QueueSerializationTest.php
rename to core/tests/Drupal/KernelTests/Core/Queue/QueueSerializationTest.php
index b8eaaf3..3ea4c66 100644
--- a/core/modules/system/src/Tests/Queue/QueueSerializationTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Queue/QueueSerializationTest.php
@@ -1,12 +1,12 @@
 <?php
 
-namespace Drupal\system\Tests\Queue;
+namespace Drupal\KernelTests\Core\Queue;
 
 use Drupal\Core\DependencyInjection\DependencySerializationTrait;
 use Drupal\Core\Form\FormInterface;
 use Drupal\Core\Form\FormState;
 use Drupal\Core\Form\FormStateInterface;
-use Drupal\simpletest\KernelTestBase;
+use Drupal\KernelTests\KernelTestBase;
 use Drupal\user\Entity\User;
 
 /**
diff --git a/core/modules/system/src/Tests/Queue/QueueTest.php b/core/tests/Drupal/KernelTests/Core/Queue/QueueTest.php
similarity index 97%
rename from core/modules/system/src/Tests/Queue/QueueTest.php
rename to core/tests/Drupal/KernelTests/Core/Queue/QueueTest.php
index 2c0513c..1a2af7d 100644
--- a/core/modules/system/src/Tests/Queue/QueueTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Queue/QueueTest.php
@@ -1,11 +1,11 @@
 <?php
 
-namespace Drupal\system\Tests\Queue;
+namespace Drupal\KernelTests\Core\Queue;
 
 use Drupal\Core\Database\Database;
 use Drupal\Core\Queue\DatabaseQueue;
 use Drupal\Core\Queue\Memory;
-use Drupal\simpletest\KernelTestBase;
+use Drupal\KernelTests\KernelTestBase;
 
 /**
  * Queues and dequeues a set of items to check the basic queue functionality.
diff --git a/core/modules/system/src/Tests/Common/RenderElementTypesTest.php b/core/tests/Drupal/KernelTests/Core/Render/Element/RenderElementTypesTest.php
similarity index 98%
rename from core/modules/system/src/Tests/Common/RenderElementTypesTest.php
rename to core/tests/Drupal/KernelTests/Core/Render/Element/RenderElementTypesTest.php
index e60bb52..3e11695 100644
--- a/core/modules/system/src/Tests/Common/RenderElementTypesTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Render/Element/RenderElementTypesTest.php
@@ -1,10 +1,10 @@
 <?php
 
-namespace Drupal\system\Tests\Common;
+namespace Drupal\KernelTests\Core\Render\Element;
 
 use Drupal\Component\Utility\Html;
 use Drupal\Core\Url;
-use Drupal\simpletest\KernelTestBase;
+use Drupal\KernelTests\KernelTestBase;
 
 /**
  * Tests the markup of core render element types passed to drupal_render().
diff --git a/core/modules/system/src/Tests/Common/TableSortExtenderUnitTest.php b/core/tests/Drupal/KernelTests/Core/Render/Element/TableSortExtenderTest.php
similarity index 97%
rename from core/modules/system/src/Tests/Common/TableSortExtenderUnitTest.php
rename to core/tests/Drupal/KernelTests/Core/Render/Element/TableSortExtenderTest.php
index 9b456a9..a77d52e 100644
--- a/core/modules/system/src/Tests/Common/TableSortExtenderUnitTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Render/Element/TableSortExtenderTest.php
@@ -1,9 +1,9 @@
 <?php
 
-namespace Drupal\system\Tests\Common;
+namespace Drupal\KernelTests\Core\Render\Element;
 
 use Drupal\Component\Utility\Html;
-use Drupal\simpletest\KernelTestBase;
+use Drupal\KernelTests\KernelTestBase;
 use Symfony\Component\HttpFoundation\Request;
 
 /**
@@ -11,7 +11,7 @@
  *
  * @group Common
  */
-class TableSortExtenderUnitTest extends KernelTestBase {
+class TableSortExtenderTest extends KernelTestBase {
 
   /**
    * Tests tablesort_init().
diff --git a/core/modules/system/src/Tests/Render/Element/TableTest.php b/core/tests/Drupal/KernelTests/Core/Render/Element/TableTest.php
similarity index 97%
rename from core/modules/system/src/Tests/Render/Element/TableTest.php
rename to core/tests/Drupal/KernelTests/Core/Render/Element/TableTest.php
index efeb2eb..34cbfc0 100644
--- a/core/modules/system/src/Tests/Render/Element/TableTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Render/Element/TableTest.php
@@ -1,8 +1,8 @@
 <?php
 
-namespace Drupal\system\Tests\Render\Element;
+namespace Drupal\KernelTests\Core\Render\Element;
 
-use Drupal\simpletest\KernelTestBase;
+use Drupal\KernelTests\KernelTestBase;
 
 /**
  * Tests built-in table theme functions.
@@ -19,15 +19,6 @@ class TableTest extends KernelTestBase {
   public static $modules = ['system', 'form_test'];
 
   /**
-   * {@inheritdoc}
-   */
-  protected function setUp() {
-    parent::setUp();
-
-    \Drupal::service('router.builder')->rebuild();
-  }
-
-  /**
    * Tableheader.js provides 'sticky' table headers, and is included by default.
    */
   function testThemeTableStickyHeaders() {
diff --git a/core/modules/system/src/Tests/Render/ElementInfoIntegrationTest.php b/core/tests/Drupal/KernelTests/Core/Render/ElementInfoIntegrationTest.php
similarity index 93%
rename from core/modules/system/src/Tests/Render/ElementInfoIntegrationTest.php
rename to core/tests/Drupal/KernelTests/Core/Render/ElementInfoIntegrationTest.php
index 5a47787..cd33fcb 100644
--- a/core/modules/system/src/Tests/Render/ElementInfoIntegrationTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Render/ElementInfoIntegrationTest.php
@@ -1,8 +1,8 @@
 <?php
 
-namespace Drupal\system\Tests\Render;
+namespace Drupal\KernelTests\Core\Render;
 
-use Drupal\simpletest\KernelTestBase;
+use Drupal\KernelTests\KernelTestBase;
 
 /**
  * Tests the element info.
diff --git a/core/modules/system/src/Tests/Render/RenderCacheTest.php b/core/tests/Drupal/KernelTests/Core/Render/RenderCacheTest.php
similarity index 97%
rename from core/modules/system/src/Tests/Render/RenderCacheTest.php
rename to core/tests/Drupal/KernelTests/Core/Render/RenderCacheTest.php
index 370ae58..91061ca 100644
--- a/core/modules/system/src/Tests/Render/RenderCacheTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Render/RenderCacheTest.php
@@ -1,8 +1,8 @@
 <?php
 
-namespace Drupal\system\Tests\Render;
+namespace Drupal\KernelTests\Core\Render;
 
-use Drupal\simpletest\KernelTestBase;
+use Drupal\KernelTests\KernelTestBase;
 use Drupal\simpletest\UserCreationTrait;
 
 /**
diff --git a/core/modules/system/src/Tests/Common/RenderTest.php b/core/tests/Drupal/KernelTests/Core/Render/RenderTest.php
similarity index 95%
rename from core/modules/system/src/Tests/Common/RenderTest.php
rename to core/tests/Drupal/KernelTests/Core/Render/RenderTest.php
index 1eee23e..8860c19 100644
--- a/core/modules/system/src/Tests/Common/RenderTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Render/RenderTest.php
@@ -1,8 +1,8 @@
 <?php
 
-namespace Drupal\system\Tests\Common;
+namespace Drupal\KernelTests\Core\Render;
 
-use Drupal\simpletest\KernelTestBase;
+use Drupal\KernelTests\KernelTestBase;
 
 /**
  * Performs functional tests on drupal_render().
diff --git a/core/modules/system/src/Tests/RouteProcessor/RouteNoneTest.php b/core/tests/Drupal/KernelTests/Core/RouteProcessor/RouteNoneTest.php
similarity index 97%
rename from core/modules/system/src/Tests/RouteProcessor/RouteNoneTest.php
rename to core/tests/Drupal/KernelTests/Core/RouteProcessor/RouteNoneTest.php
index 8457934..2b59933 100644
--- a/core/modules/system/src/Tests/RouteProcessor/RouteNoneTest.php
+++ b/core/tests/Drupal/KernelTests/Core/RouteProcessor/RouteNoneTest.php
@@ -1,11 +1,11 @@
 <?php
 
-namespace Drupal\system\Tests\RouteProcessor;
+namespace Drupal\KernelTests\Core\RouteProcessor;
 
 use Drupal\Core\Cache\Cache;
 use Drupal\Core\GeneratedUrl;
 use Drupal\Core\Render\BubbleableMetadata;
-use Drupal\simpletest\KernelTestBase;
+use Drupal\KernelTests\KernelTestBase;
 use Symfony\Cmf\Component\Routing\RouteObjectInterface;
 use Symfony\Component\HttpFoundation\Request;
 use Symfony\Component\Routing\Route;
@@ -37,8 +37,6 @@ class RouteNoneTest extends KernelTestBase {
   protected function setUp() {
     parent::setUp();
 
-    \Drupal::service('router.builder')->rebuild();
-
     $this->urlGenerator = \Drupal::urlGenerator();
   }
 
diff --git a/core/modules/system/src/Tests/RouteProcessor/RouteProcessorCurrentIntegrationTest.php b/core/tests/Drupal/KernelTests/Core/RouteProcessor/RouteProcessorCurrentIntegrationTest.php
similarity index 97%
rename from core/modules/system/src/Tests/RouteProcessor/RouteProcessorCurrentIntegrationTest.php
rename to core/tests/Drupal/KernelTests/Core/RouteProcessor/RouteProcessorCurrentIntegrationTest.php
index a09621b..ea6a9c2 100644
--- a/core/modules/system/src/Tests/RouteProcessor/RouteProcessorCurrentIntegrationTest.php
+++ b/core/tests/Drupal/KernelTests/Core/RouteProcessor/RouteProcessorCurrentIntegrationTest.php
@@ -1,11 +1,11 @@
 <?php
 
-namespace Drupal\system\Tests\RouteProcessor;
+namespace Drupal\KernelTests\Core\RouteProcessor;
 
 use Drupal\Core\Cache\Cache;
 use Drupal\Core\GeneratedUrl;
 use Drupal\Core\Render\BubbleableMetadata;
-use Drupal\simpletest\KernelTestBase;
+use Drupal\KernelTests\KernelTestBase;
 use Symfony\Cmf\Component\Routing\RouteObjectInterface;
 use Symfony\Component\HttpFoundation\Request;
 use Symfony\Component\Routing\Route;
@@ -36,8 +36,6 @@ class RouteProcessorCurrentIntegrationTest extends KernelTestBase {
   protected function setUp() {
     parent::setUp();
 
-    \Drupal::service('router.builder')->rebuild();
-
     $this->urlGenerator = \Drupal::urlGenerator();
   }
 
diff --git a/core/modules/system/src/Tests/Routing/ContentNegotiationRoutingTest.php b/core/tests/Drupal/KernelTests/Core/Routing/ContentNegotiationRoutingTest.php
similarity index 91%
rename from core/modules/system/src/Tests/Routing/ContentNegotiationRoutingTest.php
rename to core/tests/Drupal/KernelTests/Core/Routing/ContentNegotiationRoutingTest.php
index 8a9a26c..812e437 100644
--- a/core/modules/system/src/Tests/Routing/ContentNegotiationRoutingTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Routing/ContentNegotiationRoutingTest.php
@@ -1,9 +1,9 @@
 <?php
 
-namespace Drupal\system\Tests\Routing;
+namespace Drupal\KernelTests\Core\Routing;
 
 use Drupal\Core\DependencyInjection\ContainerBuilder;
-use Drupal\simpletest\KernelTestBase;
+use Drupal\KernelTests\KernelTestBase;
 use Symfony\Component\HttpFoundation\Request;
 use Symfony\Component\HttpFoundation\Response;
 
@@ -17,25 +17,15 @@ class ContentNegotiationRoutingTest extends KernelTestBase {
   /**
    * {@inheritdoc}
    */
-  public static $modules = ['system', 'conneg_test'];
+  public static $modules = ['conneg_test'];
 
   /**
    * {@inheritdoc}
    */
-  protected function setUp() {
-    \Drupal::unsetContainer();
-    parent::setUp();
+  public function register(ContainerBuilder $container) {
+    parent::register($container);
 
-    \Drupal::service('router.builder')->rebuild();
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function containerBuild(ContainerBuilder $container) {
-    parent::containerBuild($container);
-
-    // \Drupal\simpletest\KernelTestBase::containerBuild() removes the alias path
+    // \Drupal\KernelTests\KernelTestBase::register() removes the alias path
     // processor.
     if ($container->hasDefinition('path_processor_alias')) {
       $definition = $container->getDefinition('path_processor_alias');
diff --git a/core/modules/system/src/Tests/Routing/ExceptionHandlingTest.php b/core/tests/Drupal/KernelTests/Core/Routing/ExceptionHandlingTest.php
similarity index 98%
rename from core/modules/system/src/Tests/Routing/ExceptionHandlingTest.php
rename to core/tests/Drupal/KernelTests/Core/Routing/ExceptionHandlingTest.php
index 962f2dd..ab9cd92 100644
--- a/core/modules/system/src/Tests/Routing/ExceptionHandlingTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Routing/ExceptionHandlingTest.php
@@ -1,9 +1,9 @@
 <?php
 
-namespace Drupal\system\Tests\Routing;
+namespace Drupal\KernelTests\Core\Routing;
 
 use Drupal\Component\Utility\Html;
-use Drupal\simpletest\KernelTestBase;
+use Drupal\KernelTests\KernelTestBase;
 use Symfony\Component\HttpFoundation\Request;
 use Symfony\Component\HttpFoundation\Response;
 
@@ -26,7 +26,6 @@ protected function setUp() {
     parent::setUp();
 
     $this->installEntitySchema('date_format');
-    \Drupal::service('router.builder')->rebuild();
   }
 
   /**
diff --git a/core/modules/system/src/Tests/Routing/MatcherDumperTest.php b/core/tests/Drupal/KernelTests/Core/Routing/MatcherDumperTest.php
similarity index 98%
rename from core/modules/system/src/Tests/Routing/MatcherDumperTest.php
rename to core/tests/Drupal/KernelTests/Core/Routing/MatcherDumperTest.php
index 102aa1a..7c06df0 100644
--- a/core/modules/system/src/Tests/Routing/MatcherDumperTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Routing/MatcherDumperTest.php
@@ -1,10 +1,10 @@
 <?php
 
-namespace Drupal\system\Tests\Routing;
+namespace Drupal\KernelTests\Core\Routing;
 
 use Drupal\Core\KeyValueStore\KeyValueMemoryFactory;
 use Drupal\Core\State\State;
-use Drupal\simpletest\KernelTestBase;
+use Drupal\KernelTests\KernelTestBase;
 use Symfony\Component\Routing\Route;
 use Symfony\Component\Routing\RouteCollection;
 use Drupal\Core\Database\Database;
diff --git a/core/modules/system/src/Tests/Routing/RouteProviderTest.php b/core/tests/Drupal/KernelTests/Core/Routing/RouteProviderTest.php
similarity index 98%
rename from core/modules/system/src/Tests/Routing/RouteProviderTest.php
rename to core/tests/Drupal/KernelTests/Core/Routing/RouteProviderTest.php
index 056a37a..d28ca5e 100644
--- a/core/modules/system/src/Tests/Routing/RouteProviderTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Routing/RouteProviderTest.php
@@ -2,10 +2,10 @@
 
 /**
  * @file
- * Contains \Drupal\system\Tests\Routing\RouteProviderTest.
+ * Contains \Drupal\KernelTests\Core\Routing\RouteProviderTest.
  */
 
-namespace Drupal\system\Tests\Routing;
+namespace Drupal\KernelTests\Core\Routing;
 
 use Drupal\Core\Cache\MemoryBackend;
 use Drupal\Core\Database\Database;
@@ -15,14 +15,14 @@
 use Drupal\Core\Routing\MatcherDumper;
 use Drupal\Core\Routing\RouteProvider;
 use Drupal\Core\State\State;
+use Drupal\KernelTests\KernelTestBase;
 use Drupal\Tests\Core\Routing\RoutingFixtures;
-use Drupal\simpletest\KernelTestBase;
 use Symfony\Component\HttpFoundation\Request;
 use Symfony\Component\HttpFoundation\RequestStack;
+use Symfony\Component\Routing\Exception\ResourceNotFoundException;
 use Symfony\Component\Routing\Exception\RouteNotFoundException;
 use Symfony\Component\Routing\Route;
 use Symfony\Component\Routing\RouteCollection;
-use Symfony\Component\Routing\Exception\ResourceNotFoundException;
 
 /**
  * Confirm that the default route provider is working correctly.
@@ -91,8 +91,8 @@ protected function setUp() {
   /**
    * {@inheritdoc}
    */
-  public function containerBuild(ContainerBuilder $container) {
-    parent::containerBuild($container); // TODO: Change the autogenerated stub
+  public function register(ContainerBuilder $container) {
+    parent::register($container);
 
     // Readd the incoming path alias for these tests.
     if ($container->hasDefinition('path_processor_alias')) {
diff --git a/core/modules/system/src/Tests/Routing/UrlIntegrationTest.php b/core/tests/Drupal/KernelTests/Core/Routing/UrlIntegrationTest.php
similarity index 92%
rename from core/modules/system/src/Tests/Routing/UrlIntegrationTest.php
rename to core/tests/Drupal/KernelTests/Core/Routing/UrlIntegrationTest.php
index bf927fe..a70cc1f 100644
--- a/core/modules/system/src/Tests/Routing/UrlIntegrationTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Routing/UrlIntegrationTest.php
@@ -1,9 +1,9 @@
 <?php
 
-namespace Drupal\system\Tests\Routing;
+namespace Drupal\KernelTests\Core\Routing;
 
 use Drupal\Core\Url;
-use Drupal\simpletest\KernelTestBase;
+use Drupal\KernelTests\KernelTestBase;
 use Drupal\user\Entity\Role;
 use Drupal\user\Entity\User;
 
@@ -25,7 +25,6 @@ class UrlIntegrationTest extends KernelTestBase {
    * Ensures that the access() method on \Drupal\Core\Url objects works.
    */
   public function testAccess() {
-    \Drupal::service('router.builder')->rebuild();
     /** @var \Drupal\user\RoleInterface $role_with_access */
     $role_with_access = Role::create(['id' => 'role_with_access']);
     $role_with_access->grantPermission('administer users');
diff --git a/core/modules/system/src/Tests/ServiceProvider/ServiceProviderTest.php b/core/tests/Drupal/KernelTests/Core/ServiceProvider/ServiceProviderTest.php
similarity index 93%
rename from core/modules/system/src/Tests/ServiceProvider/ServiceProviderTest.php
rename to core/tests/Drupal/KernelTests/Core/ServiceProvider/ServiceProviderTest.php
index 9d1cc72..2995c97 100644
--- a/core/modules/system/src/Tests/ServiceProvider/ServiceProviderTest.php
+++ b/core/tests/Drupal/KernelTests/Core/ServiceProvider/ServiceProviderTest.php
@@ -1,8 +1,8 @@
 <?php
 
-namespace Drupal\system\Tests\ServiceProvider;
+namespace Drupal\KernelTests\Core\ServiceProvider;
 
-use Drupal\simpletest\KernelTestBase;
+use Drupal\KernelTests\KernelTestBase;
 
 /**
  * Tests service provider registration to the DIC.
@@ -16,7 +16,7 @@ class ServiceProviderTest extends KernelTestBase {
    *
    * @var array
    */
-  public static $modules = array('file', 'service_provider_test');
+  public static $modules = array('file', 'service_provider_test', 'system');
 
   /**
    * Tests that services provided by module service providers get registered to the DIC.
diff --git a/core/modules/system/src/Tests/Session/AccountSwitcherTest.php b/core/tests/Drupal/KernelTests/Core/Session/AccountSwitcherTest.php
similarity index 96%
rename from core/modules/system/src/Tests/Session/AccountSwitcherTest.php
rename to core/tests/Drupal/KernelTests/Core/Session/AccountSwitcherTest.php
index 7f771f6..0e6fa8a 100644
--- a/core/modules/system/src/Tests/Session/AccountSwitcherTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Session/AccountSwitcherTest.php
@@ -1,9 +1,9 @@
 <?php
 
-namespace Drupal\system\Tests\Session;
+namespace Drupal\KernelTests\Core\Session;
 
 use Drupal\Core\Session\UserSession;
-use Drupal\simpletest\KernelTestBase;
+use Drupal\KernelTests\KernelTestBase;
 
 /**
  * Test case for account switching.
diff --git a/core/modules/system/src/Tests/System/SettingsRewriteTest.php b/core/tests/Drupal/KernelTests/Core/Site/SettingsRewriteTest.php
similarity index 88%
rename from core/modules/system/src/Tests/System/SettingsRewriteTest.php
rename to core/tests/Drupal/KernelTests/Core/Site/SettingsRewriteTest.php
index 630db65..948236b 100644
--- a/core/modules/system/src/Tests/System/SettingsRewriteTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Site/SettingsRewriteTest.php
@@ -1,9 +1,9 @@
 <?php
 
-namespace Drupal\system\Tests\System;
+namespace Drupal\KernelTests\Core\Site;
 
 use Drupal\Core\Site\Settings;
-use Drupal\simpletest\KernelTestBase;
+use Drupal\KernelTests\KernelTestBase;
 
 /**
  * Tests the drupal_rewrite_settings() function.
@@ -11,6 +11,7 @@
  * @group system
  */
 class SettingsRewriteTest extends KernelTestBase {
+
   /**
    * Tests the drupal_rewrite_settings() function.
    */
@@ -96,9 +97,9 @@ function testDrupalRewriteSettings() {
     );
     foreach ($tests as $test) {
       $filename = Settings::get('file_public_path', $site_path . '/files') . '/mock_settings.php';
-      file_put_contents(\Drupal::root() . '/' . $filename, "<?php\n" . $test['original'] . "\n");
+      file_put_contents($filename, "<?php\n" . $test['original'] . "\n");
       drupal_rewrite_settings($test['settings'], $filename);
-      $this->assertEqual(file_get_contents(\Drupal::root() . '/' . $filename), "<?php\n" . $test['expected'] . "\n");
+      $this->assertEqual(file_get_contents($filename), "<?php\n" . $test['expected'] . "\n");
     }
 
     // Test that <?php gets added to the start of an empty settings file.
@@ -114,13 +115,13 @@ function testDrupalRewriteSettings() {
     );
     // Make an empty file.
     $filename = Settings::get('file_public_path', $site_path . '/files') . '/mock_settings.php';
-    file_put_contents(\Drupal::root() . '/' . $filename, "");
+    file_put_contents($filename, "");
 
     // Write the setting to the file.
     drupal_rewrite_settings($test['settings'], $filename);
 
     // Check that the result is just the php opening tag and the settings.
-    $this->assertEqual(file_get_contents(\Drupal::root() . '/' . $filename), "<?php\n" . $test['expected'] . "\n");
+    $this->assertEqual(file_get_contents($filename), "<?php\n" . $test['expected'] . "\n");
   }
 
 }
diff --git a/core/modules/system/src/Tests/Theme/ImageTest.php b/core/tests/Drupal/KernelTests/Core/Theme/ImageTest.php
similarity index 96%
rename from core/modules/system/src/Tests/Theme/ImageTest.php
rename to core/tests/Drupal/KernelTests/Core/Theme/ImageTest.php
index b5323f4..51608eb 100644
--- a/core/modules/system/src/Tests/Theme/ImageTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Theme/ImageTest.php
@@ -1,8 +1,8 @@
 <?php
 
-namespace Drupal\system\Tests\Theme;
+namespace Drupal\KernelTests\Core\Theme;
 
-use Drupal\simpletest\KernelTestBase;
+use Drupal\KernelTests\KernelTestBase;
 use Symfony\Component\HttpFoundation\Request;
 
 /**
@@ -33,7 +33,7 @@ protected function setUp() {
     // the Request containing the correct hostname. KernelTestBase doesn't set
     // it, so push another request onto the stack to ensure it's correct.
     $request = Request::create('/', 'GET', [], [], [], $_SERVER);
-    $this->container = $this->kernel->getContainer();
+    $this->container = \Drupal::service('kernel')->getContainer();
     $this->container->get('request_stack')->push($request);
 
     $this->testImages = array(
diff --git a/core/modules/system/src/Tests/Theme/MessageTest.php b/core/tests/Drupal/KernelTests/Core/Theme/MessageTest.php
similarity index 90%
rename from core/modules/system/src/Tests/Theme/MessageTest.php
rename to core/tests/Drupal/KernelTests/Core/Theme/MessageTest.php
index 6605e81..76e14e9 100644
--- a/core/modules/system/src/Tests/Theme/MessageTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Theme/MessageTest.php
@@ -1,8 +1,8 @@
 <?php
 
-namespace Drupal\system\Tests\Theme;
+namespace Drupal\KernelTests\Core\Theme;
 
-use Drupal\simpletest\KernelTestBase;
+use Drupal\KernelTests\KernelTestBase;
 
 /**
  * Tests built-in message theme functions.
diff --git a/core/modules/system/src/Tests/Theme/RegistryTest.php b/core/tests/Drupal/KernelTests/Core/Theme/RegistryTest.php
similarity index 98%
rename from core/modules/system/src/Tests/Theme/RegistryTest.php
rename to core/tests/Drupal/KernelTests/Core/Theme/RegistryTest.php
index a17d8ed..93e931b 100644
--- a/core/modules/system/src/Tests/Theme/RegistryTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Theme/RegistryTest.php
@@ -1,10 +1,10 @@
 <?php
 
-namespace Drupal\system\Tests\Theme;
+namespace Drupal\KernelTests\Core\Theme;
 
 use Drupal\Core\Theme\Registry;
-use Drupal\simpletest\KernelTestBase;
 use Drupal\Core\Utility\ThemeRegistry;
+use Drupal\KernelTests\KernelTestBase;
 
 /**
  * Tests the behavior of the ThemeRegistry class.
diff --git a/core/modules/system/src/Tests/Theme/StableLibraryOverrideTest.php b/core/tests/Drupal/KernelTests/Core/Theme/StableLibraryOverrideTest.php
similarity index 95%
rename from core/modules/system/src/Tests/Theme/StableLibraryOverrideTest.php
rename to core/tests/Drupal/KernelTests/Core/Theme/StableLibraryOverrideTest.php
index d7a6541..400206d 100644
--- a/core/modules/system/src/Tests/Theme/StableLibraryOverrideTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Theme/StableLibraryOverrideTest.php
@@ -1,8 +1,8 @@
 <?php
 
-namespace Drupal\system\Tests\Theme;
+namespace Drupal\KernelTests\Core\Theme;
 
-use Drupal\simpletest\KernelTestBase;
+use Drupal\KernelTests\KernelTestBase;
 
 /**
  * Tests Stable's library overrides.
@@ -49,13 +49,14 @@ class StableLibraryOverrideTest extends KernelTestBase {
   /**
    * {@inheritdoc}
    */
+  public static $modules = ['system'];
+
+  /**
+   * {@inheritdoc}
+   */
   protected function setUp() {
     parent::setUp();
 
-    $this->themeManager = $this->container->get('theme.manager');
-    $this->themeInitialization = $this->container->get('theme.initialization');
-    $this->libraryDiscovery = $this->container->get('library.discovery');
-
     $this->container->get('theme_installer')->install(['stable']);
 
     // Enable all core modules.
@@ -69,8 +70,13 @@ protected function setUp() {
       return TRUE;
     });
     $this->allModules = array_keys($all_modules);
+    $this->allModules[] = 'system';
     sort($this->allModules);
-    $this->enableModules($this->allModules);
+    $this->container->get('module_installer')->install($this->allModules);
+
+    $this->themeManager = $this->container->get('theme.manager');
+    $this->themeInitialization = $this->container->get('theme.initialization');
+    $this->libraryDiscovery = $this->container->get('library.discovery');
   }
 
   /**
diff --git a/core/modules/system/src/Tests/Theme/StableThemeTest.php b/core/tests/Drupal/KernelTests/Core/Theme/StableThemeTest.php
similarity index 95%
rename from core/modules/system/src/Tests/Theme/StableThemeTest.php
rename to core/tests/Drupal/KernelTests/Core/Theme/StableThemeTest.php
index 1290847..da585d0 100644
--- a/core/modules/system/src/Tests/Theme/StableThemeTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Theme/StableThemeTest.php
@@ -1,8 +1,8 @@
 <?php
 
-namespace Drupal\system\Tests\Theme;
+namespace Drupal\KernelTests\Core\Theme;
 
-use Drupal\simpletest\KernelTestBase;
+use Drupal\KernelTests\KernelTestBase;
 
 /**
  * Tests the behavior of the Stable theme.
diff --git a/core/modules/system/src/Tests/Extension/ThemeInstallerTest.php b/core/tests/Drupal/KernelTests/Core/Theme/ThemeInstallerTest.php
similarity index 98%
rename from core/modules/system/src/Tests/Extension/ThemeInstallerTest.php
rename to core/tests/Drupal/KernelTests/Core/Theme/ThemeInstallerTest.php
index ecf83e9..b82978c 100644
--- a/core/modules/system/src/Tests/Extension/ThemeInstallerTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Theme/ThemeInstallerTest.php
@@ -1,10 +1,10 @@
 <?php
 
-namespace Drupal\system\Tests\Extension;
+namespace Drupal\KernelTests\Core\Theme;
 
 use Drupal\Core\DependencyInjection\ContainerBuilder;
 use Drupal\Core\Extension\ExtensionNameLengthException;
-use Drupal\simpletest\KernelTestBase;
+use Drupal\KernelTests\KernelTestBase;
 
 /**
  * Tests installing and uninstalling of themes.
@@ -20,8 +20,11 @@ class ThemeInstallerTest extends KernelTestBase {
    */
   public static $modules = array('system');
 
-  public function containerBuild(ContainerBuilder $container) {
-    parent::containerBuild($container);
+  /**
+   * {@inheritdoc}
+   */
+  public function register(ContainerBuilder $container) {
+    parent::register($container);
     // Some test methods involve ModuleHandler operations, which attempt to
     // rebuild and dump routes.
     $container
diff --git a/core/modules/system/src/Tests/Theme/ThemeSettingsTest.php b/core/tests/Drupal/KernelTests/Core/Theme/ThemeSettingsTest.php
similarity index 95%
rename from core/modules/system/src/Tests/Theme/ThemeSettingsTest.php
rename to core/tests/Drupal/KernelTests/Core/Theme/ThemeSettingsTest.php
index b7e6866..6c2dfb3 100644
--- a/core/modules/system/src/Tests/Theme/ThemeSettingsTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Theme/ThemeSettingsTest.php
@@ -1,10 +1,10 @@
 <?php
 
-namespace Drupal\system\Tests\Theme;
+namespace Drupal\KernelTests\Core\Theme;
 
 use Drupal\Core\Config\InstallStorage;
 use Drupal\Core\Extension\ExtensionDiscovery;
-use Drupal\simpletest\KernelTestBase;
+use Drupal\KernelTests\KernelTestBase;
 
 /**
  * Tests theme settings functionality.
diff --git a/core/modules/system/src/Tests/Theme/TwigEnvironmentTest.php b/core/tests/Drupal/KernelTests/Core/Theme/TwigEnvironmentTest.php
similarity index 97%
rename from core/modules/system/src/Tests/Theme/TwigEnvironmentTest.php
rename to core/tests/Drupal/KernelTests/Core/Theme/TwigEnvironmentTest.php
index ef3c4697..deaf033 100644
--- a/core/modules/system/src/Tests/Theme/TwigEnvironmentTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Theme/TwigEnvironmentTest.php
@@ -1,10 +1,10 @@
 <?php
 
-namespace Drupal\system\Tests\Theme;
+namespace Drupal\KernelTests\Core\Theme;
 
 use Drupal\Component\Utility\Html;
 use Drupal\Core\Site\Settings;
-use Drupal\simpletest\KernelTestBase;
+use Drupal\KernelTests\KernelTestBase;
 
 /**
  * Tests the twig environment.
@@ -47,7 +47,7 @@ public function testInlineTemplate() {
     $settings['twig_auto_reload'] = TRUE;
 
     new Settings($settings);
-    $this->container = $this->kernel->rebuildContainer();
+    $this->container = \Drupal::service('kernel')->rebuildContainer();
     \Drupal::setContainer($this->container);
 
     $element = array();
diff --git a/core/modules/system/src/Tests/Theme/TwigWhiteListTest.php b/core/tests/Drupal/KernelTests/Core/Theme/TwigWhiteListTest.php
similarity index 97%
rename from core/modules/system/src/Tests/Theme/TwigWhiteListTest.php
rename to core/tests/Drupal/KernelTests/Core/Theme/TwigWhiteListTest.php
index 7f644fe..41984d6 100644
--- a/core/modules/system/src/Tests/Theme/TwigWhiteListTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Theme/TwigWhiteListTest.php
@@ -1,13 +1,13 @@
 <?php
 
-namespace Drupal\system\Tests\Theme;
+namespace Drupal\KernelTests\Core\Theme;
 
 use Drupal\Core\Language\LanguageInterface;
 use Drupal\field\Entity\FieldConfig;
 use Drupal\field\Entity\FieldStorageConfig;
+use Drupal\KernelTests\KernelTestBase;
 use Drupal\node\Entity\Node;
 use Drupal\node\Entity\NodeType;
-use Drupal\simpletest\KernelTestBase;
 use Drupal\taxonomy\Entity\Term;
 use Drupal\taxonomy\Entity\Vocabulary;
 
diff --git a/core/modules/system/src/Tests/Validation/AllowedValuesConstraintValidatorTest.php b/core/tests/Drupal/KernelTests/Core/TypedData/AllowedValuesConstraintValidatorTest.php
similarity index 95%
rename from core/modules/system/src/Tests/Validation/AllowedValuesConstraintValidatorTest.php
rename to core/tests/Drupal/KernelTests/Core/TypedData/AllowedValuesConstraintValidatorTest.php
index 3970166..4a23fbb 100644
--- a/core/modules/system/src/Tests/Validation/AllowedValuesConstraintValidatorTest.php
+++ b/core/tests/Drupal/KernelTests/Core/TypedData/AllowedValuesConstraintValidatorTest.php
@@ -1,9 +1,9 @@
 <?php
 
-namespace Drupal\system\Tests\Validation;
+namespace Drupal\KernelTests\Core\TypedData;
 
 use Drupal\Core\TypedData\DataDefinition;
-use Drupal\simpletest\KernelTestBase;
+use Drupal\KernelTests\KernelTestBase;
 
 /**
  * Tests AllowedValues validation constraint with both valid and invalid values.
diff --git a/core/modules/system/src/Tests/Validation/ComplexDataConstraintValidatorTest.php b/core/tests/Drupal/KernelTests/Core/TypedData/ComplexDataConstraintValidatorTest.php
similarity index 97%
rename from core/modules/system/src/Tests/Validation/ComplexDataConstraintValidatorTest.php
rename to core/tests/Drupal/KernelTests/Core/TypedData/ComplexDataConstraintValidatorTest.php
index d75d405..078cb7a 100644
--- a/core/modules/system/src/Tests/Validation/ComplexDataConstraintValidatorTest.php
+++ b/core/tests/Drupal/KernelTests/Core/TypedData/ComplexDataConstraintValidatorTest.php
@@ -1,10 +1,10 @@
 <?php
 
-namespace Drupal\system\Tests\Validation;
+namespace Drupal\KernelTests\Core\TypedData;
 
 use Drupal\Core\TypedData\DataDefinition;
 use Drupal\Core\TypedData\MapDataDefinition;
-use Drupal\simpletest\KernelTestBase;
+use Drupal\KernelTests\KernelTestBase;
 
 /**
  * Tests ComplexData validation constraint with both valid and invalid values
diff --git a/core/modules/system/src/Tests/TypedData/TypedDataDefinitionTest.php b/core/tests/Drupal/KernelTests/Core/TypedData/TypedDataDefinitionTest.php
similarity index 97%
rename from core/modules/system/src/Tests/TypedData/TypedDataDefinitionTest.php
rename to core/tests/Drupal/KernelTests/Core/TypedData/TypedDataDefinitionTest.php
index 034987b..4ff9ff6 100644
--- a/core/modules/system/src/Tests/TypedData/TypedDataDefinitionTest.php
+++ b/core/tests/Drupal/KernelTests/Core/TypedData/TypedDataDefinitionTest.php
@@ -1,6 +1,6 @@
 <?php
 
-namespace Drupal\system\Tests\TypedData;
+namespace Drupal\KernelTests\Core\TypedData;
 
 use Drupal\Core\TypedData\ComplexDataDefinitionInterface;
 use Drupal\Core\TypedData\DataDefinition;
@@ -10,7 +10,7 @@
 use Drupal\Core\TypedData\ListDataDefinition;
 use Drupal\Core\TypedData\ListDataDefinitionInterface;
 use Drupal\Core\TypedData\MapDataDefinition;
-use Drupal\simpletest\KernelTestBase;
+use Drupal\KernelTests\KernelTestBase;
 
 /**
  * Tests deriving metadata of core data types.
diff --git a/core/modules/system/src/Tests/TypedData/TypedDataTest.php b/core/tests/Drupal/KernelTests/Core/TypedData/TypedDataTest.php
similarity index 99%
rename from core/modules/system/src/Tests/TypedData/TypedDataTest.php
rename to core/tests/Drupal/KernelTests/Core/TypedData/TypedDataTest.php
index 8473485..08f27b3 100644
--- a/core/modules/system/src/Tests/TypedData/TypedDataTest.php
+++ b/core/tests/Drupal/KernelTests/Core/TypedData/TypedDataTest.php
@@ -1,6 +1,6 @@
 <?php
 
-namespace Drupal\system\Tests\TypedData;
+namespace Drupal\KernelTests\Core\TypedData;
 
 use Drupal\Core\Datetime\DrupalDateTime;
 use Drupal\Core\Field\BaseFieldDefinition;
@@ -17,7 +17,7 @@
 use Drupal\Core\TypedData\Type\UriInterface;
 use Drupal\Core\TypedData\TypedDataInterface;
 use Drupal\file\Entity\File;
-use Drupal\simpletest\KernelTestBase;
+use Drupal\KernelTests\KernelTestBase;
 
 /**
  * Tests the functionality of all core data types.
diff --git a/core/modules/system/src/Tests/Update/CompatibilityFixTest.php b/core/tests/Drupal/KernelTests/Core/Update/CompatibilityFixTest.php
similarity index 91%
rename from core/modules/system/src/Tests/Update/CompatibilityFixTest.php
rename to core/tests/Drupal/KernelTests/Core/Update/CompatibilityFixTest.php
index 6689c2f..ee1b6e1 100644
--- a/core/modules/system/src/Tests/Update/CompatibilityFixTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Update/CompatibilityFixTest.php
@@ -1,8 +1,8 @@
 <?php
 
-namespace Drupal\system\Tests\Update;
+namespace Drupal\KernelTests\Core\Update;
 
-use Drupal\simpletest\KernelTestBase;
+use Drupal\KernelTests\KernelTestBase;
 
 /**
  * Tests that extensions that are incompatible with the current core version are disabled.
@@ -11,6 +11,11 @@
  */
 class CompatibilityFixTest extends KernelTestBase {
 
+  /**
+   * {@inheritdoc}
+   */
+  public static $modules = ['system'];
+
   protected function setUp() {
     parent::setUp();
     require_once \Drupal::root() . '/core/includes/update.inc';
diff --git a/core/modules/system/src/Tests/Extension/UpdaterTest.php b/core/tests/Drupal/KernelTests/Core/Updater/UpdaterTest.php
similarity index 91%
rename from core/modules/system/src/Tests/Extension/UpdaterTest.php
rename to core/tests/Drupal/KernelTests/Core/Updater/UpdaterTest.php
index 1c277a5..185a3fe 100644
--- a/core/modules/system/src/Tests/Extension/UpdaterTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Updater/UpdaterTest.php
@@ -1,9 +1,9 @@
 <?php
 
-namespace Drupal\system\Tests\Extension;
+namespace Drupal\KernelTests\Core\Updater;
 
-use Drupal\simpletest\KernelTestBase;
 use Drupal\Core\Updater\Updater;
+use Drupal\KernelTests\KernelTestBase;
 
 /**
  * Tests InfoParser class and exception.
diff --git a/core/modules/system/src/Tests/Utility/LinkGenerationTest.php b/core/tests/Drupal/KernelTests/Core/Url/LinkGenerationTest.php
similarity index 97%
rename from core/modules/system/src/Tests/Utility/LinkGenerationTest.php
rename to core/tests/Drupal/KernelTests/Core/Url/LinkGenerationTest.php
index fabb6c7..3d7ce5e 100644
--- a/core/modules/system/src/Tests/Utility/LinkGenerationTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Url/LinkGenerationTest.php
@@ -1,11 +1,11 @@
 <?php
 
-namespace Drupal\system\Tests\Utility;
+namespace Drupal\KernelTests\Core\Url;
 
 use Drupal\Component\Render\MarkupInterface;
 use Drupal\Core\Render\RenderContext;
 use Drupal\Core\Url;
-use Drupal\simpletest\KernelTestBase;
+use Drupal\KernelTests\KernelTestBase;
 
 /**
  * Tests link generation with hooks.
diff --git a/core/tests/Drupal/KernelTests/KernelTestBase.php b/core/tests/Drupal/KernelTests/KernelTestBase.php
index 6c41f07..08e599a 100644
--- a/core/tests/Drupal/KernelTests/KernelTestBase.php
+++ b/core/tests/Drupal/KernelTests/KernelTestBase.php
@@ -261,18 +261,6 @@ protected function bootEnvironment() {
       $this->databasePrefix = 'simpletest' . $suffix;
     } while (is_dir($this->root . '/' . $this->siteDirectory));
 
-    $this->vfsRoot = vfsStream::setup('root', NULL, array(
-      'sites' => array(
-        'simpletest' => array(
-          $suffix => array(),
-        ),
-      ),
-    ));
-    $this->siteDirectory = vfsStream::url('root/sites/simpletest/' . $suffix);
-
-    mkdir($this->siteDirectory . '/files', 0775);
-    mkdir($this->siteDirectory . '/files/config/' . CONFIG_SYNC_DIRECTORY, 0775, TRUE);
-
     // Ensure that all code that relies on drupal_valid_test_ua() can still be
     // safely executed. This primarily affects the (test) site directory
     // resolution (used by e.g. LocalStream and PhpStorage).
@@ -288,9 +276,7 @@ protected function bootEnvironment() {
     );
     new Settings($settings);
 
-    $GLOBALS['config_directories'] = array(
-      CONFIG_SYNC_DIRECTORY => $this->siteDirectory . '/files/config/sync',
-    );
+    $this->setUpFilesystem();
 
     foreach (Database::getAllConnectionInfo() as $key => $targets) {
       Database::removeConnection($key);
@@ -299,6 +285,32 @@ protected function bootEnvironment() {
   }
 
   /**
+   * Sets up the filesystem, so things like the file directory.
+   */
+  protected function setUpFilesystem() {
+    $suffix = str_replace('simpletest', '', $this->databasePrefix);
+    $this->vfsRoot = vfsStream::setup('root', NULL, array(
+      'sites' => array(
+        'simpletest' => array(
+          $suffix => array(),
+        ),
+      ),
+    ));
+    $this->siteDirectory = vfsStream::url('root/sites/simpletest/' . $suffix);
+
+    mkdir($this->siteDirectory . '/files', 0775);
+    mkdir($this->siteDirectory . '/files/config/' . CONFIG_SYNC_DIRECTORY, 0775, TRUE);
+
+    $settings = Settings::getInstance() ? Settings::getAll() : [];
+    $settings['file_public_path'] = $this->siteDirectory . '/files';
+    new Settings($settings);
+
+    $GLOBALS['config_directories'] = array(
+      CONFIG_SYNC_DIRECTORY => $this->siteDirectory . '/files/config/sync',
+    );
+  }
+
+  /**
    * @return string
    */
   public function getDatabasePrefix() {
@@ -663,7 +675,7 @@ protected function assertPostConditions() {
     }
 
     // Shut down the kernel (if bootKernel() was called).
-    // @see \Drupal\system\Tests\DrupalKernel\DrupalKernelTest
+    // @see \Drupal\KernelTests\Core\DrupalKernel\DrupalKernelTest
     if ($this->container) {
       $this->container->get('kernel')->shutdown();
     }
@@ -998,7 +1010,7 @@ protected function render(array &$elements) {
    *   \Drupal\Core\Site\Settings::get() to perform custom merges.
    */
   protected function setSetting($name, $value) {
-    $settings = Settings::getAll();
+    $settings = Settings::getInstance() ? Settings::getAll() : [];
     $settings[$name] = $value;
     new Settings($settings);
   }
diff --git a/core/tests/Drupal/Tests/Core/Plugin/Discovery/DerivativeDiscoveryDecoratorTest.php b/core/tests/Drupal/Tests/Core/Plugin/Discovery/DerivativeDiscoveryDecoratorTest.php
index 2ceb9a3..d81360f 100644
--- a/core/tests/Drupal/Tests/Core/Plugin/Discovery/DerivativeDiscoveryDecoratorTest.php
+++ b/core/tests/Drupal/Tests/Core/Plugin/Discovery/DerivativeDiscoveryDecoratorTest.php
@@ -111,14 +111,14 @@ public function testNonExistentDerivativeFetcher() {
    * @see \Drupal\Component\Plugin\Discovery\DerivativeDiscoveryDecorator::getDeriver().\
    *
    * @expectedException \Drupal\Component\Plugin\Exception\InvalidDeriverException
-   * @expectedExceptionMessage Plugin (invalid_discovery) deriver "\Drupal\system\Tests\Plugin\DerivativeTest" must implement \Drupal\Component\Plugin\Derivative\DeriverInterface.
+   * @expectedExceptionMessage Plugin (invalid_discovery) deriver "\Drupal\KernelTests\Core\Plugin\DerivativeTest" must implement \Drupal\Component\Plugin\Derivative\DeriverInterface.
    */
   public function testInvalidDerivativeFetcher() {
     $definitions = array();
     // Do this with a class that doesn't implement the interface.
     $definitions['invalid_discovery'] = array(
       'id' => 'invalid_discovery',
-      'deriver' => '\Drupal\system\Tests\Plugin\DerivativeTest',
+      'deriver' => '\Drupal\KernelTests\Core\Plugin\DerivativeTest',
     );
     $this->discoveryMain->expects($this->any())
       ->method('getDefinitions')
