diff --git a/core/tests/Drupal/KernelTests/AssertLegacyTrait.php b/core/tests/Drupal/KernelTests/AssertLegacyTrait.php
index 6165871..81b6935 100644
--- a/core/tests/Drupal/KernelTests/AssertLegacyTrait.php
+++ b/core/tests/Drupal/KernelTests/AssertLegacyTrait.php
@@ -59,7 +59,7 @@ public static function assertFalse($actual, $message = '') {
    *   instead.
    */
   protected function assertEqual($actual, $expected, $message = '') {
-    $this->assertEquals($expected, $actual, $message);
+    $this->assertEquals($this->castSafeStrings($expected), $this->castSafeStrings($actual), $message);
   }
 
   /**
diff --git a/core/modules/system/src/Tests/Entity/BundleConstraintValidatorTest.php b/core/tests/Drupal/KernelTests/Core/Entity/BundleConstraintValidatorTest.php
similarity index 94%
rename from core/modules/system/src/Tests/Entity/BundleConstraintValidatorTest.php
rename to core/tests/Drupal/KernelTests/Core/Entity/BundleConstraintValidatorTest.php
index 2a433c5..5f8d510 100644
--- a/core/modules/system/src/Tests/Entity/BundleConstraintValidatorTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Entity/BundleConstraintValidatorTest.php
@@ -2,13 +2,13 @@
 
 /**
  * @file
- * Contains \Drupal\system\Tests\Entity\BundleConstraintValidatorTest.
+ * Contains \Drupal\KernelTests\Core\Entity\BundleConstraintValidatorTest.
  */
 
-namespace Drupal\system\Tests\Entity;
+namespace Drupal\KernelTests\Core\Entity;
 
 use Drupal\Core\TypedData\DataDefinition;
-use Drupal\simpletest\KernelTestBase;
+use Drupal\KernelTests\KernelTestBase;
 use Drupal\system\Tests\TypedData;
 
 /**
diff --git a/core/modules/system/src/Tests/Entity/ConfigEntityQueryTest.php b/core/tests/Drupal/KernelTests/Core/Entity/ConfigEntityQueryTest.php
similarity index 98%
rename from core/modules/system/src/Tests/Entity/ConfigEntityQueryTest.php
rename to core/tests/Drupal/KernelTests/Core/Entity/ConfigEntityQueryTest.php
index 09a21d2..3687f34 100644
--- a/core/modules/system/src/Tests/Entity/ConfigEntityQueryTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Entity/ConfigEntityQueryTest.php
@@ -2,14 +2,14 @@
 
 /**
  * @file
- * Contains \Drupal\system\Tests\Entity\ConfigEntityQueryTest.
+ * Contains \Drupal\KernelTests\Core\Entity\ConfigEntityQueryTest.
  */
 
-namespace Drupal\system\Tests\Entity;
+namespace Drupal\KernelTests\Core\Entity;
 
 use Drupal\Core\Config\Entity\Query\QueryFactory;
-use Drupal\simpletest\KernelTestBase;
 use Drupal\config_test\Entity\ConfigQueryTest;
+use Drupal\KernelTests\KernelTestBase;
 
 /**
  * Tests Config Entity Query functionality.
@@ -642,7 +642,7 @@ public function testLookupKeys() {
 
     // Ensure that a delete clears a key.
     $entity->delete();
-    $this->assertEqual([], $key_value->get('style:blah'));
+    $this->assertEqual(NULL, $key_value->get('style:blah'));
 
     // Ensure that delete only clears one key.
     $entity_id = array_pop($expected);
@@ -650,7 +650,7 @@ public function testLookupKeys() {
     $this->assertEqual($expected, $key_value->get('style:test'));
     $entity_id = array_pop($expected);
     $test_entities[$entity_id]->delete();
-    $this->assertEqual($expected, $key_value->get('style:test'));
+    $this->assertEqual(NULL, $key_value->get('style:test'));
   }
 
   /**
diff --git a/core/modules/system/src/Tests/Entity/ContentEntityChangedTest.php b/core/tests/Drupal/KernelTests/Core/Entity/ContentEntityChangedTest.php
similarity index 99%
rename from core/modules/system/src/Tests/Entity/ContentEntityChangedTest.php
rename to core/tests/Drupal/KernelTests/Core/Entity/ContentEntityChangedTest.php
index 94c9b12..eddb268 100644
--- a/core/modules/system/src/Tests/Entity/ContentEntityChangedTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Entity/ContentEntityChangedTest.php
@@ -2,10 +2,10 @@
 
 /**
  * @file
- * Contains \Drupal\system\Tests\Entity\ContentEntityChangedTest.
+ * Contains \Drupal\KernelTests\Core\Entity\ContentEntityChangedTest.
  */
 
-namespace Drupal\system\Tests\Entity;
+namespace Drupal\KernelTests\Core\Entity;
 
 use Drupal\entity_test\Entity\EntityTestMulChanged;
 use Drupal\entity_test\Entity\EntityTestMulRevChanged;
@@ -16,7 +16,7 @@
  *
  * @group Entity
  */
-class ContentEntityChangedTest extends EntityUnitTestBase {
+class ContentEntityChangedTest extends EntityKernelTestBase {
 
   /**
    * Modules to enable.
diff --git a/core/modules/system/src/Tests/Entity/ContentEntityCloneTest.php b/core/tests/Drupal/KernelTests/Core/Entity/ContentEntityCloneTest.php
similarity index 92%
rename from core/modules/system/src/Tests/Entity/ContentEntityCloneTest.php
rename to core/tests/Drupal/KernelTests/Core/Entity/ContentEntityCloneTest.php
index 77d1603..742708a 100644
--- a/core/modules/system/src/Tests/Entity/ContentEntityCloneTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Entity/ContentEntityCloneTest.php
@@ -2,10 +2,10 @@
 
 /**
  * @file
- * Contains \Drupal\system\Tests\Entity\ContentEntityCloneTest.
+ * Contains \Drupal\KernelTests\Core\Entity\ContentEntityCloneTest.
  */
 
-namespace Drupal\system\Tests\Entity;
+namespace Drupal\KernelTests\Core\Entity;
 
 use Drupal\entity_test\Entity\EntityTestMul;
 use Drupal\language\Entity\ConfigurableLanguage;
@@ -15,7 +15,7 @@
  *
  * @group Entity
  */
-class ContentEntityCloneTest extends EntityUnitTestBase {
+class ContentEntityCloneTest extends EntityKernelTestBase {
 
   /**
    * {@inheritdoc}
diff --git a/core/modules/system/src/Tests/Entity/ContentEntityNullStorageTest.php b/core/tests/Drupal/KernelTests/Core/Entity/ContentEntityNullStorageTest.php
similarity index 94%
rename from core/modules/system/src/Tests/Entity/ContentEntityNullStorageTest.php
rename to core/tests/Drupal/KernelTests/Core/Entity/ContentEntityNullStorageTest.php
index 3eeee3b..6d4b70c 100644
--- a/core/modules/system/src/Tests/Entity/ContentEntityNullStorageTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Entity/ContentEntityNullStorageTest.php
@@ -2,15 +2,15 @@
 
 /**
  * @file
- * Contains \Drupal\system\Tests\Entity\ContentEntityNullStorageTest.
+ * Contains \Drupal\KernelTests\Core\Entity\ContentEntityNullStorageTest.
  */
 
-namespace Drupal\system\Tests\Entity;
+namespace Drupal\KernelTests\Core\Entity;
 
 use Drupal\contact\Entity\ContactForm;
 use Drupal\Core\Config\ConfigImporter;
 use Drupal\Core\Config\StorageComparer;
-use Drupal\simpletest\KernelTestBase;
+use Drupal\KernelTests\KernelTestBase;
 
 /**
  * Tests ContentEntityNullStorage entity query support.
diff --git a/core/modules/system/src/Tests/Entity/Element/EntityAutocompleteElementFormTest.php b/core/tests/Drupal/KernelTests/Core/Entity/Element/EntityAutocompleteElementFormTest.php
similarity index 97%
rename from core/modules/system/src/Tests/Entity/Element/EntityAutocompleteElementFormTest.php
rename to core/tests/Drupal/KernelTests/Core/Entity/Element/EntityAutocompleteElementFormTest.php
index 17f93c9..2622910 100644
--- a/core/modules/system/src/Tests/Entity/Element/EntityAutocompleteElementFormTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Entity/Element/EntityAutocompleteElementFormTest.php
@@ -2,10 +2,10 @@
 
 /**
  * @file
- * Contains \Drupal\system\Tests\Entity\Element\EntityAutocompleteElementFormTest.
+ * Contains \Drupal\KernelTests\Core\Entity\Element\EntityAutocompleteElementFormTest.
  */
 
-namespace Drupal\system\Tests\Entity\Element;
+namespace Drupal\KernelTests\Core\Entity\Element;
 
 use Drupal\Core\Entity\Element\EntityAutocomplete;
 use Drupal\Core\Entity\EntityInterface;
@@ -13,7 +13,7 @@
 use Drupal\Core\Form\FormState;
 use Drupal\Core\Form\FormStateInterface;
 use Drupal\entity_test\Entity\EntityTest;
-use Drupal\system\Tests\Entity\EntityUnitTestBase;
+use Drupal\KernelTests\Core\Entity\EntityKernelTestBase;
 use Drupal\user\Entity\User;
 
 /**
@@ -21,7 +21,7 @@
  *
  * @group Form
  */
-class EntityAutocompleteElementFormTest extends EntityUnitTestBase implements FormInterface {
+class EntityAutocompleteElementFormTest extends EntityKernelTestBase implements FormInterface {
 
   /**
    * User for testing.
diff --git a/core/modules/system/src/Tests/Entity/EntityAccessControlHandlerTest.php b/core/tests/Drupal/KernelTests/Core/Entity/EntityAccessControlHandlerTest.php
similarity index 98%
rename from core/modules/system/src/Tests/Entity/EntityAccessControlHandlerTest.php
rename to core/tests/Drupal/KernelTests/Core/Entity/EntityAccessControlHandlerTest.php
index f2f05b4..8e52453 100644
--- a/core/modules/system/src/Tests/Entity/EntityAccessControlHandlerTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Entity/EntityAccessControlHandlerTest.php
@@ -2,10 +2,10 @@
 
 /**
  * @file
- * Contains \Drupal\system\Tests\Entity\EntityAccessControlHandlerTest.
+ * Contains \Drupal\KernelTests\Core\Entity\EntityAccessControlHandlerTest.
  */
 
-namespace Drupal\system\Tests\Entity;
+namespace Drupal\KernelTests\Core\Entity;
 
 use Drupal\Core\Language\LanguageInterface;
 use Drupal\Core\Session\AccountInterface;
diff --git a/core/modules/system/src/Tests/Entity/EntityApiTest.php b/core/tests/Drupal/KernelTests/Core/Entity/EntityApiTest.php
similarity index 97%
rename from core/modules/system/src/Tests/Entity/EntityApiTest.php
rename to core/tests/Drupal/KernelTests/Core/Entity/EntityApiTest.php
index 7445734..8dc5daf 100644
--- a/core/modules/system/src/Tests/Entity/EntityApiTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Entity/EntityApiTest.php
@@ -2,10 +2,10 @@
 
 /**
  * @file
- * Contains \Drupal\system\Tests\Entity\EntityApiTest.
+ * Contains \Drupal\KernelTests\Core\Entity\EntityApiTest.
  */
 
-namespace Drupal\system\Tests\Entity;
+namespace Drupal\KernelTests\Core\Entity;
 
 use Drupal\Core\Entity\EntityStorageException;
 use Drupal\entity_test\Entity\EntityTest;
@@ -16,7 +16,7 @@
  *
  * @group Entity
  */
-class EntityApiTest extends EntityUnitTestBase {
+class EntityApiTest extends EntityKernelTestBase {
 
   /**
    * {@inheritdoc}
diff --git a/core/modules/system/src/Tests/Entity/EntityAutocompleteTest.php b/core/tests/Drupal/KernelTests/Core/Entity/EntityAutocompleteTest.php
similarity index 97%
rename from core/modules/system/src/Tests/Entity/EntityAutocompleteTest.php
rename to core/tests/Drupal/KernelTests/Core/Entity/EntityAutocompleteTest.php
index d42a07a..950c0bb 100644
--- a/core/modules/system/src/Tests/Entity/EntityAutocompleteTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Entity/EntityAutocompleteTest.php
@@ -2,10 +2,10 @@
 
 /**
  * @file
- * Contains \Drupal\system\Tests\Entity\EntityAutocompleteTest.
+ * Contains \Drupal\KernelTests\Core\Entity\EntityAutocompleteTest.
  */
 
-namespace Drupal\system\Tests\Entity;
+namespace Drupal\KernelTests\Core\Entity;
 
 use Drupal\Component\Serialization\Json;
 use Drupal\Component\Utility\Crypt;
@@ -21,7 +21,7 @@
  *
  * @group Entity
  */
-class EntityAutocompleteTest extends EntityUnitTestBase {
+class EntityAutocompleteTest extends EntityKernelTestBase {
 
   /**
    * The entity type used in this test.
diff --git a/core/modules/system/src/Tests/Entity/EntityBundleFieldTest.php b/core/tests/Drupal/KernelTests/Core/Entity/EntityBundleFieldTest.php
similarity index 95%
rename from core/modules/system/src/Tests/Entity/EntityBundleFieldTest.php
rename to core/tests/Drupal/KernelTests/Core/Entity/EntityBundleFieldTest.php
index 006c5e2..0d69d71 100644
--- a/core/modules/system/src/Tests/Entity/EntityBundleFieldTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Entity/EntityBundleFieldTest.php
@@ -2,17 +2,17 @@
 
 /**
  * @file
- * Contains \Drupal\system\Tests\Entity\EntityBundleFieldTest.
+ * Contains \Drupal\KernelTests\Core\Entity\EntityBundleFieldTest.
  */
 
-namespace Drupal\system\Tests\Entity;
+namespace Drupal\KernelTests\Core\Entity;
 
 /**
  * Tests adding a custom bundle field.
  *
  * @group Entity
  */
-class EntityBundleFieldTest extends EntityUnitTestBase  {
+class EntityBundleFieldTest extends EntityKernelTestBase  {
 
   /**
    * Modules to enable.
diff --git a/core/modules/system/src/Tests/Entity/EntityCrudHookTest.php b/core/tests/Drupal/KernelTests/Core/Entity/EntityCrudHookTest.php
similarity index 99%
rename from core/modules/system/src/Tests/Entity/EntityCrudHookTest.php
rename to core/tests/Drupal/KernelTests/Core/Entity/EntityCrudHookTest.php
index 8268a43..4d78d47 100644
--- a/core/modules/system/src/Tests/Entity/EntityCrudHookTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Entity/EntityCrudHookTest.php
@@ -2,10 +2,10 @@
 
 /**
  * @file
- * Contains \Drupal\system\Tests\Entity\EntityCrudHookTest.
+ * Contains \Drupal\KernelTests\Core\Entity\EntityCrudHookTest.
  */
 
-namespace Drupal\system\Tests\Entity;
+namespace Drupal\KernelTests\Core\Entity;
 
 use Drupal\comment\Entity\Comment;
 use Drupal\comment\Plugin\Field\FieldType\CommentItemInterface;
@@ -36,7 +36,7 @@
  *
  * @group Entity
  */
-class EntityCrudHookTest extends EntityUnitTestBase {
+class EntityCrudHookTest extends EntityKernelTestBase {
 
   use CommentTestTrait;
 
diff --git a/core/modules/system/src/Tests/Entity/EntityDefinitionUpdateTest.php b/core/tests/Drupal/KernelTests/Core/Entity/EntityDefinitionUpdateTest.php
similarity index 99%
rename from core/modules/system/src/Tests/Entity/EntityDefinitionUpdateTest.php
rename to core/tests/Drupal/KernelTests/Core/Entity/EntityDefinitionUpdateTest.php
index 177fd52..e3b3b41 100644
--- a/core/modules/system/src/Tests/Entity/EntityDefinitionUpdateTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Entity/EntityDefinitionUpdateTest.php
@@ -2,10 +2,10 @@
 
 /**
  * @file
- * Contains \Drupal\system\Tests\Entity\EntityDefinitionUpdateTest.
+ * Contains \Drupal\KernelTests\Core\Entity\EntityDefinitionUpdateTest.
  */
 
-namespace Drupal\system\Tests\Entity;
+namespace Drupal\KernelTests\Core\Entity;
 
 use Drupal\Component\Plugin\Exception\PluginNotFoundException;
 use Drupal\Core\Database\Database;
@@ -19,13 +19,14 @@
 use Drupal\Core\Field\FieldStorageDefinitionEvents;
 use Drupal\Core\Language\LanguageInterface;
 use Drupal\entity_test\Entity\EntityTestUpdate;
+use Drupal\system\Tests\Entity\EntityDefinitionTestTrait;
 
 /**
  * Tests EntityDefinitionUpdateManager functionality.
  *
  * @group Entity
  */
-class EntityDefinitionUpdateTest extends EntityUnitTestBase {
+class EntityDefinitionUpdateTest extends EntityKernelTestBase {
 
   use EntityDefinitionTestTrait;
 
diff --git a/core/modules/system/src/Tests/Entity/EntityFieldDefaultValueTest.php b/core/tests/Drupal/KernelTests/Core/Entity/EntityFieldDefaultValueTest.php
similarity index 92%
rename from core/modules/system/src/Tests/Entity/EntityFieldDefaultValueTest.php
rename to core/tests/Drupal/KernelTests/Core/Entity/EntityFieldDefaultValueTest.php
index e8453ff..500bbad 100644
--- a/core/modules/system/src/Tests/Entity/EntityFieldDefaultValueTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Entity/EntityFieldDefaultValueTest.php
@@ -2,10 +2,10 @@
 
 /**
  * @file
- * Contains \Drupal\system\Tests\Entity\EntityFieldDefaultValueTest.
+ * Contains \Drupal\KernelTests\Core\Entity\EntityFieldDefaultValueTest.
  */
 
-namespace Drupal\system\Tests\Entity;
+namespace Drupal\KernelTests\Core\Entity;
 
 use Drupal\Component\Uuid\Uuid;
 use Drupal\Component\Utility\SafeMarkup;
@@ -15,7 +15,7 @@
  *
  * @group Entity
  */
-class EntityFieldDefaultValueTest extends EntityUnitTestBase  {
+class EntityFieldDefaultValueTest extends EntityKernelTestBase  {
 
   /**
    * The UUID object to be used for generating UUIDs.
diff --git a/core/modules/system/src/Tests/Entity/EntityFieldTest.php b/core/tests/Drupal/KernelTests/Core/Entity/EntityFieldTest.php
similarity index 99%
rename from core/modules/system/src/Tests/Entity/EntityFieldTest.php
rename to core/tests/Drupal/KernelTests/Core/Entity/EntityFieldTest.php
index 5c9161e..2781c65 100644
--- a/core/modules/system/src/Tests/Entity/EntityFieldTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Entity/EntityFieldTest.php
@@ -2,10 +2,10 @@
 
 /**
  * @file
- * Contains \Drupal\system\Tests\Entity\EntityFieldTest.
+ * Contains \Drupal\KernelTests\Core\Entity\EntityFieldTest.
  */
 
-namespace Drupal\system\Tests\Entity;
+namespace Drupal\KernelTests\Core\Entity;
 
 use Drupal\Core\Entity\EntityInterface;
 use Drupal\Core\Field\BaseFieldDefinition;
@@ -23,7 +23,7 @@
  *
  * @group Entity
  */
-class EntityFieldTest extends EntityUnitTestBase  {
+class EntityFieldTest extends EntityKernelTestBase  {
 
   /**
    * Modules to enable.
diff --git a/core/tests/Drupal/KernelTests/Core/Entity/EntityKernelTestBase.php b/core/tests/Drupal/KernelTests/Core/Entity/EntityKernelTestBase.php
new file mode 100644
index 0000000..1096ce2
--- /dev/null
+++ b/core/tests/Drupal/KernelTests/Core/Entity/EntityKernelTestBase.php
@@ -0,0 +1,201 @@
+<?php
+
+/**
+ * @file
+ * Contains \Drupal\KernelTests\Core\Entity\EntityKernelTestBase.
+ */
+
+namespace Drupal\KernelTests\Core\Entity;
+
+use Drupal\Core\Entity\EntityInterface;
+use Drupal\KernelTests\KernelTestBase;
+
+/**
+ * Defines an abstract test base for entity kernel tests.
+ */
+abstract class EntityKernelTestBase extends KernelTestBase {
+
+  /**
+   * Modules to enable.
+   *
+   * @var array
+   */
+  public static $modules = ['user', 'system', 'field', 'text', 'filter', 'entity_test'];
+
+  /**
+   * The entity manager service.
+   *
+   * @var \Drupal\Core\Entity\EntityManagerInterface
+   */
+  protected $entityManager;
+
+  /**
+   * A list of generated identifiers.
+   *
+   * @var array
+   */
+  protected $generatedIds = array();
+
+  /**
+   * The state service.
+   *
+   * @var \Drupal\Core\State\StateInterface
+   */
+  protected $state;
+
+  protected function setUp() {
+    parent::setUp();
+
+    $this->entityManager = $this->container->get('entity.manager');
+    $this->state = $this->container->get('state');
+
+    $this->installSchema('system', 'sequences');
+
+    $this->installEntitySchema('user');
+    $this->installEntitySchema('entity_test');
+
+    // If the concrete test sub-class installs the Node or Comment modules,
+    // ensure that the node and comment entity schema are created before the
+    // field configurations are installed. This is because the entity tables
+    // need to be created before the body field storage tables. This prevents
+    // trying to create the body field tables twice.
+    $class = get_class($this);
+    while ($class) {
+      if (property_exists($class, 'modules')) {
+        // Only check the modules, if the $modules property was not inherited.
+        $rp = new \ReflectionProperty($class, 'modules');
+        if ($rp->class == $class) {
+          foreach (array_intersect(array('node', 'comment'), $class::$modules) as $module) {
+            $this->installEntitySchema($module);
+          }
+          if (in_array('forum', $class::$modules, TRUE)) {
+            // Forum module is particular about the order that dependencies are
+            // enabled in. The comment, node and taxonomy config and the
+            // taxonomy_term schema need to be installed before the forum config
+            // which in turn needs to be installed before field config.
+            $this->installConfig(['comment', 'node', 'taxonomy']);
+            $this->installEntitySchema('taxonomy_term');
+            $this->installConfig(['forum']);
+          }
+        }
+      }
+      $class = get_parent_class($class);
+    }
+
+    $this->installConfig(array('field'));
+  }
+
+  /**
+   * Creates a user.
+   *
+   * @param array $values
+   *   (optional) The values used to create the entity.
+   * @param array $permissions
+   *   (optional) Array of permission names to assign to user.
+   *
+   * @return \Drupal\user\Entity\User
+   *   The created user entity.
+   */
+  protected function createUser($values = array(), $permissions = array()) {
+    if ($permissions) {
+      // Create a new role and apply permissions to it.
+      $role = entity_create('user_role', array(
+        'id' => strtolower($this->randomMachineName(8)),
+        'label' => $this->randomMachineName(8),
+      ));
+      $role->save();
+      user_role_grant_permissions($role->id(), $permissions);
+      $values['roles'][] = $role->id();
+    }
+
+    $account = entity_create('user', $values + array(
+      'name' => $this->randomMachineName(),
+      'status' => 1,
+    ));
+    $account->enforceIsNew();
+    $account->save();
+    return $account;
+  }
+
+  /**
+   * Reloads the given entity from the storage and returns it.
+   *
+   * @param \Drupal\Core\Entity\EntityInterface $entity
+   *   The entity to be reloaded.
+   *
+   * @return \Drupal\Core\Entity\EntityInterface
+   *   The reloaded entity.
+   */
+  protected function reloadEntity(EntityInterface $entity) {
+    $controller = $this->entityManager->getStorage($entity->getEntityTypeId());
+    $controller->resetCache(array($entity->id()));
+    return $controller->load($entity->id());
+  }
+
+  /**
+   * Returns the entity_test hook invocation info.
+   *
+   * @return array
+   *   An associative array of arbitrary hook data keyed by hook name.
+   */
+  protected function getHooksInfo() {
+    $key = 'entity_test.hooks';
+    $hooks = $this->state->get($key);
+    $this->state->set($key, array());
+    return $hooks;
+  }
+
+  /**
+   * Installs a module and refreshes services.
+   *
+   * @param string $module
+   *   The module to install.
+   */
+  protected function installModule($module) {
+    $this->enableModules(array($module));
+    $this->refreshServices();
+  }
+
+  /**
+   * Uninstalls a module and refreshes services.
+   *
+   * @param string $module
+   *   The module to uninstall.
+   */
+  protected function uninstallModule($module) {
+    $this->disableModules(array($module));
+    $this->refreshServices();
+  }
+
+  /**
+   * Refresh services.
+   */
+  protected function refreshServices() {
+    $this->container = \Drupal::getContainer();
+    $this->entityManager = $this->container->get('entity.manager');
+    $this->state = $this->container->get('state');
+  }
+
+  /**
+   * Generates a random ID avoiding collisions.
+   *
+   * @param bool $string
+   *   (optional) Whether the id should have string type. Defaults to FALSE.
+   *
+   * @return int|string
+   *   The entity identifier.
+   */
+  protected function generateRandomEntityId($string = FALSE) {
+    srand(time());
+    do {
+      // 0x7FFFFFFF is the maximum allowed value for integers that works for all
+      // Drupal supported databases and is known to work for other databases
+      // like SQL Server 2014 and Oracle 10 too.
+      $id = $string ? $this->randomMachineName() : mt_rand(1, 0x7FFFFFFF);
+    }
+    while (isset($this->generatedIds[$id]));
+    $this->generatedIds[$id] = $id;
+    return $id;
+  }
+
+}
diff --git a/core/modules/system/src/Tests/Entity/EntityLanguageTestBase.php b/core/tests/Drupal/KernelTests/Core/Entity/EntityLanguageTestBase.php
similarity index 92%
rename from core/modules/system/src/Tests/Entity/EntityLanguageTestBase.php
rename to core/tests/Drupal/KernelTests/Core/Entity/EntityLanguageTestBase.php
index 27ad447..8897eeb 100644
--- a/core/modules/system/src/Tests/Entity/EntityLanguageTestBase.php
+++ b/core/tests/Drupal/KernelTests/Core/Entity/EntityLanguageTestBase.php
@@ -2,10 +2,10 @@
 
 /**
  * @file
- * Contains \Drupal\system\Tests\Entity\EntityLanguageTestBase.
+ * Contains \Drupal\KernelTests\Core\Entity\EntityLanguageTestBase.
  */
 
-namespace Drupal\system\Tests\Entity;
+namespace Drupal\KernelTests\Core\Entity;
 
 use Drupal\Component\Utility\Unicode;
 use Drupal\language\Entity\ConfigurableLanguage;
@@ -15,7 +15,7 @@
 /**
  * Base class for language-aware entity tests.
  */
-abstract class EntityLanguageTestBase extends EntityUnitTestBase {
+abstract class EntityLanguageTestBase extends EntityKernelTestBase {
 
   /**
    * The language manager service.
@@ -88,7 +88,6 @@ protected function setUp() {
         'bundle' => $entity_type,
         'translatable' => TRUE,
       ])->save();
-      $this->field[$entity_type] = FieldConfig::load($entity_type . '.' . $entity_type . '.' . $this->fieldName);
 
       FieldStorageConfig::create(array(
         'field_name' => $this->untranslatableFieldName,
diff --git a/core/modules/system/src/Tests/Entity/EntityQueryAggregateTest.php b/core/tests/Drupal/KernelTests/Core/Entity/EntityQueryAggregateTest.php
similarity index 99%
rename from core/modules/system/src/Tests/Entity/EntityQueryAggregateTest.php
rename to core/tests/Drupal/KernelTests/Core/Entity/EntityQueryAggregateTest.php
index 57fe7c5..d7ab5e9 100644
--- a/core/modules/system/src/Tests/Entity/EntityQueryAggregateTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Entity/EntityQueryAggregateTest.php
@@ -2,10 +2,10 @@
 
 /**
  * @file
- * Contains \Drupal\system\Tests\Entity\EntityQueryAggregateTest.
+ * Contains \Drupal\KernelTests\Core\Entity\EntityQueryAggregateTest.
  */
 
-namespace Drupal\system\Tests\Entity;
+namespace Drupal\KernelTests\Core\Entity;
 
 use Drupal\field\Entity\FieldConfig;
 use Drupal\field\Entity\FieldStorageConfig;
@@ -16,7 +16,7 @@
  * @group Entity
  * @see \Drupal\entity_test\Entity\EntityTest
  */
-class EntityQueryAggregateTest extends EntityUnitTestBase {
+class EntityQueryAggregateTest extends EntityKernelTestBase {
 
   /**
    * Modules to enable.
diff --git a/core/modules/system/src/Tests/Entity/EntityQueryRelationshipTest.php b/core/tests/Drupal/KernelTests/Core/Entity/EntityQueryRelationshipTest.php
similarity index 96%
rename from core/modules/system/src/Tests/Entity/EntityQueryRelationshipTest.php
rename to core/tests/Drupal/KernelTests/Core/Entity/EntityQueryRelationshipTest.php
index 35a4bda..4639e78 100644
--- a/core/modules/system/src/Tests/Entity/EntityQueryRelationshipTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Entity/EntityQueryRelationshipTest.php
@@ -2,10 +2,10 @@
 
 /**
  * @file
- * Contains \Drupal\system\Tests\Entity\EntityQueryRelationshipTest.
+ * Contains \Drupal\KernelTests\Core\Entity\EntityQueryRelationshipTest.
  */
 
-namespace Drupal\system\Tests\Entity;
+namespace Drupal\KernelTests\Core\Entity;
 use Drupal\Component\Utility\Unicode;
 use Drupal\entity_test\Entity\EntityTest;
 use Drupal\field\Tests\EntityReference\EntityReferenceTestTrait;
@@ -17,7 +17,7 @@
  *
  * @group Entity
  */
-class EntityQueryRelationshipTest extends EntityUnitTestBase  {
+class EntityQueryRelationshipTest extends EntityKernelTestBase {
 
   use EntityReferenceTestTrait;
 
diff --git a/core/modules/system/src/Tests/Entity/EntityQueryTest.php b/core/tests/Drupal/KernelTests/Core/Entity/EntityQueryTest.php
similarity index 99%
rename from core/modules/system/src/Tests/Entity/EntityQueryTest.php
rename to core/tests/Drupal/KernelTests/Core/Entity/EntityQueryTest.php
index eb5a949..fbda4e1 100644
--- a/core/modules/system/src/Tests/Entity/EntityQueryTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Entity/EntityQueryTest.php
@@ -2,10 +2,10 @@
 
 /**
  * @file
- * Contains \Drupal\system\Tests\Entity\EntityQueryTest.
+ * Contains \Drupal\KernelTests\Core\Entity\EntityQueryTest.
  */
 
-namespace Drupal\system\Tests\Entity;
+namespace Drupal\KernelTests\Core\Entity;
 
 use Drupal\Component\Utility\Unicode;
 use Drupal\entity_test\Entity\EntityTest;
@@ -22,7 +22,7 @@
  *
  * @group Entity
  */
-class EntityQueryTest extends EntityUnitTestBase {
+class EntityQueryTest extends EntityKernelTestBase {
 
   /**
    * Modules to enable.
diff --git a/core/modules/system/src/Tests/Entity/EntityReferenceFieldTest.php b/core/tests/Drupal/KernelTests/Core/Entity/EntityReferenceFieldTest.php
similarity index 98%
rename from core/modules/system/src/Tests/Entity/EntityReferenceFieldTest.php
rename to core/tests/Drupal/KernelTests/Core/Entity/EntityReferenceFieldTest.php
index 33379bc..4e36eac 100644
--- a/core/modules/system/src/Tests/Entity/EntityReferenceFieldTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Entity/EntityReferenceFieldTest.php
@@ -2,10 +2,10 @@
 
 /**
  * @file
- * Contains \Drupal\system\Tests\Entity\EntityReferenceFieldTest.
+ * Contains \Drupal\KernelTests\Core\Entity\EntityReferenceFieldTest.
  */
 
-namespace Drupal\system\Tests\Entity;
+namespace Drupal\KernelTests\Core\Entity;
 
 use Drupal\config\Tests\SchemaCheckTestTrait;
 use Drupal\Core\Entity\EntityInterface;
@@ -26,7 +26,7 @@
  *
  * @group Entity
  */
-class EntityReferenceFieldTest extends EntityUnitTestBase {
+class EntityReferenceFieldTest extends EntityKernelTestBase {
 
   use SchemaCheckTestTrait;
   use EntityReferenceTestTrait;
diff --git a/core/modules/system/src/Tests/Entity/EntityReferenceSelection/EntityReferenceSelectionSortTest.php b/core/tests/Drupal/KernelTests/Core/Entity/EntityReferenceSelection/EntityReferenceSelectionSortTest.php
similarity index 95%
rename from core/modules/system/src/Tests/Entity/EntityReferenceSelection/EntityReferenceSelectionSortTest.php
rename to core/tests/Drupal/KernelTests/Core/Entity/EntityReferenceSelection/EntityReferenceSelectionSortTest.php
index 76992f1..f8e0ea9 100644
--- a/core/modules/system/src/Tests/Entity/EntityReferenceSelection/EntityReferenceSelectionSortTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Entity/EntityReferenceSelection/EntityReferenceSelectionSortTest.php
@@ -2,10 +2,10 @@
 
 /**
  * @file
- * Contains \Drupal\system\Tests\Entity\EntityReferenceSelection\EntityReferenceSelectionSortTest.
+ * Contains \Drupal\KernelTests\Core\Entity\EntityReferenceSelection\EntityReferenceSelectionSortTest.
  */
 
-namespace Drupal\system\Tests\Entity\EntityReferenceSelection;
+namespace Drupal\KernelTests\Core\Entity\EntityReferenceSelection;
 
 use Drupal\Component\Utility\Html;
 use Drupal\field\Entity\FieldConfig;
diff --git a/core/modules/system/src/Tests/Entity/EntityRevisionTranslationTest.php b/core/tests/Drupal/KernelTests/Core/Entity/EntityRevisionTranslationTest.php
similarity index 92%
rename from core/modules/system/src/Tests/Entity/EntityRevisionTranslationTest.php
rename to core/tests/Drupal/KernelTests/Core/Entity/EntityRevisionTranslationTest.php
index 0250d96..e7a4055 100644
--- a/core/modules/system/src/Tests/Entity/EntityRevisionTranslationTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Entity/EntityRevisionTranslationTest.php
@@ -2,10 +2,10 @@
 
 /**
  * @file
- * Contains \Drupal\system\Tests\Entity\EntityRevisionTranslationTest.
+ * Contains \Drupal\KernelTests\Core\Entity\EntityRevisionTranslationTest.
  */
 
-namespace Drupal\system\Tests\Entity;
+namespace Drupal\KernelTests\Core\Entity;
 
 use Drupal\entity_test\Entity\EntityTestMulRev;
 use Drupal\language\Entity\ConfigurableLanguage;
@@ -15,7 +15,7 @@
  *
  * @group Entity
  */
-class EntityRevisionTranslationTest extends EntityUnitTestBase {
+class EntityRevisionTranslationTest extends EntityKernelTestBase {
 
   /**
    * {@inheritdoc}
diff --git a/core/modules/system/src/Tests/Entity/EntitySchemaTest.php b/core/tests/Drupal/KernelTests/Core/Entity/EntitySchemaTest.php
similarity index 98%
rename from core/modules/system/src/Tests/Entity/EntitySchemaTest.php
rename to core/tests/Drupal/KernelTests/Core/Entity/EntitySchemaTest.php
index 4bf148e..5567780 100644
--- a/core/modules/system/src/Tests/Entity/EntitySchemaTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Entity/EntitySchemaTest.php
@@ -2,10 +2,10 @@
 
 /**
  * @file
- * Contains \Drupal\system\Tests\Entity\EntitySchemaTest.
+ * Contains \Drupal\KernelTests\Core\Entity\EntitySchemaTest.
  */
 
-namespace Drupal\system\Tests\Entity;
+namespace Drupal\KernelTests\Core\Entity;
 
 use Drupal\Component\Utility\SafeMarkup;
 
@@ -14,7 +14,7 @@
  *
  * @group system
  */
-class EntitySchemaTest extends EntityUnitTestBase  {
+class EntitySchemaTest extends EntityKernelTestBase  {
 
   /**
    * The database connection used.
diff --git a/core/modules/system/src/Tests/Entity/EntityTranslationTest.php b/core/tests/Drupal/KernelTests/Core/Entity/EntityTranslationTest.php
similarity index 99%
rename from core/modules/system/src/Tests/Entity/EntityTranslationTest.php
rename to core/tests/Drupal/KernelTests/Core/Entity/EntityTranslationTest.php
index de62ba7..0b60f93 100644
--- a/core/modules/system/src/Tests/Entity/EntityTranslationTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Entity/EntityTranslationTest.php
@@ -2,16 +2,17 @@
 
 /**
  * @file
- * Contains \Drupal\system\Tests\Entity\EntityTranslationTest.
+ * Contains \Drupal\KernelTests\Core\Entity\EntityTranslationTest.
  */
 
-namespace Drupal\system\Tests\Entity;
+namespace Drupal\KernelTests\Core\Entity;
 
 use Drupal\Component\Utility\SafeMarkup;
 use Drupal\Core\Language\LanguageInterface;
 use Drupal\entity_test\Entity\EntityTestMulRev;
 use Drupal\field\Entity\FieldConfig;
 use Drupal\field\Entity\FieldStorageConfig;
+use Drupal\KernelTests\Core\Entity\EntityLanguageTestBase;
 use Drupal\language\Entity\ConfigurableLanguage;
 
 /**
diff --git a/core/modules/system/src/Tests/Entity/EntityTypeConstraintValidatorTest.php b/core/tests/Drupal/KernelTests/Core/Entity/EntityTypeConstraintValidatorTest.php
similarity index 89%
rename from core/modules/system/src/Tests/Entity/EntityTypeConstraintValidatorTest.php
rename to core/tests/Drupal/KernelTests/Core/Entity/EntityTypeConstraintValidatorTest.php
index b9ebee2..fe8b5bd 100644
--- a/core/modules/system/src/Tests/Entity/EntityTypeConstraintValidatorTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Entity/EntityTypeConstraintValidatorTest.php
@@ -2,11 +2,12 @@
 
 /**
  * @file
- * Contains \Drupal\system\Tests\Entity\EntityTypeConstraintValidatorTest.
+ * Contains \Drupal\KernelTests\Core\Entity\EntityTypeConstraintValidatorTest.
  */
 
-namespace Drupal\system\Tests\Entity;
+namespace Drupal\KernelTests\Core\Entity;
 
+use Drupal\system\Tests\Entity\EntityUnitTestBase;
 use Drupal\system\Tests\TypedData;
 use Drupal\Core\TypedData\DataDefinition;
 
@@ -15,7 +16,7 @@
  *
  * @group Entity
  */
-class EntityTypeConstraintValidatorTest extends EntityUnitTestBase {
+class EntityTypeConstraintValidatorTest extends EntityKernelTestBase {
 
   /**
    * The typed data manager to use.
diff --git a/core/modules/system/src/Tests/Entity/EntityTypeConstraintsTest.php b/core/tests/Drupal/KernelTests/Core/Entity/EntityTypeConstraintsTest.php
similarity index 91%
rename from core/modules/system/src/Tests/Entity/EntityTypeConstraintsTest.php
rename to core/tests/Drupal/KernelTests/Core/Entity/EntityTypeConstraintsTest.php
index 688b96c..c9f6528 100644
--- a/core/modules/system/src/Tests/Entity/EntityTypeConstraintsTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Entity/EntityTypeConstraintsTest.php
@@ -2,10 +2,10 @@
 
 /**
  * @file
- * Contains \Drupal\system\Tests\Entity\EntityTypeConstraintsTest.
+ * Contains \Drupal\KernelTests\Core\Entity\EntityTypeConstraintsTest.
  */
 
-namespace Drupal\system\Tests\Entity;
+namespace Drupal\KernelTests\Core\Entity;
 
 use Drupal\system\Tests\TypedData;
 
@@ -14,7 +14,7 @@
  *
  * @group Entity
  */
-class EntityTypeConstraintsTest extends EntityUnitTestBase {
+class EntityTypeConstraintsTest extends EntityKernelTestBase {
 
   /**
    * {@inheritdoc}
@@ -35,7 +35,7 @@ public function testConstraintDefinition() {
     $this->assertEqual($default_constraints, $entity_type->getConstraints());
 
     // Enable our test module and test extending constraints.
-    $this->enableModules(array_merge(static::$modules, ['entity_test_constraints']));
+    $this->enableModules(['entity_test_constraints']);
     $this->container->get('module_handler')->resetImplementations();
 
     $extra_constraints = ['Test' => []];
diff --git a/core/modules/system/src/Tests/Entity/EntityTypedDataDefinitionTest.php b/core/tests/Drupal/KernelTests/Core/Entity/EntityTypedDataDefinitionTest.php
similarity index 97%
rename from core/modules/system/src/Tests/Entity/EntityTypedDataDefinitionTest.php
rename to core/tests/Drupal/KernelTests/Core/Entity/EntityTypedDataDefinitionTest.php
index d71ca15..2afdbd4 100644
--- a/core/modules/system/src/Tests/Entity/EntityTypedDataDefinitionTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Entity/EntityTypedDataDefinitionTest.php
@@ -2,10 +2,10 @@
 
 /**
  * @file
- * Contains \Drupal\system\Tests\Entity\EntityTypedDataDefinitionTest.
+ * Contains \Drupal\KernelTests\Core\Entity\EntityTypedDataDefinitionTest.
  */
 
-namespace Drupal\system\Tests\Entity;
+namespace Drupal\KernelTests\Core\Entity;
 
 use Drupal\Core\Entity\TypedData\EntityDataDefinition;
 use Drupal\Core\Entity\TypedData\EntityDataDefinitionInterface;
@@ -15,7 +15,7 @@
 use Drupal\Core\TypedData\DataReferenceDefinition;
 use Drupal\Core\TypedData\DataReferenceDefinitionInterface;
 use Drupal\Core\TypedData\ListDataDefinitionInterface;
-use Drupal\simpletest\KernelTestBase;
+use Drupal\KernelTests\KernelTestBase;
 
 /**
  * Tests deriving metadata of entity and field data types.
diff --git a/core/modules/system/src/Tests/Entity/EntityUUIDTest.php b/core/tests/Drupal/KernelTests/Core/Entity/EntityUUIDTest.php
similarity index 95%
rename from core/modules/system/src/Tests/Entity/EntityUUIDTest.php
rename to core/tests/Drupal/KernelTests/Core/Entity/EntityUUIDTest.php
index 48a6e4e..a54318d 100644
--- a/core/modules/system/src/Tests/Entity/EntityUUIDTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Entity/EntityUUIDTest.php
@@ -2,17 +2,17 @@
 
 /**
  * @file
- * Contains \Drupal\system\Tests\Entity\EntityUUIDTest.
+ * Contains \Drupal\KernelTests\Core\Entity\EntityUUIDTest.
  */
 
-namespace Drupal\system\Tests\Entity;
+namespace Drupal\KernelTests\Core\Entity;
 
 /**
  * Tests creation, saving, and loading of entity UUIDs.
  *
  * @group Entity
  */
-class EntityUUIDTest extends EntityUnitTestBase {
+class EntityUUIDTest extends EntityKernelTestBase {
 
   protected function setUp() {
     parent::setUp();
diff --git a/core/modules/system/src/Tests/Entity/EntityValidationTest.php b/core/tests/Drupal/KernelTests/Core/Entity/EntityValidationTest.php
similarity index 97%
rename from core/modules/system/src/Tests/Entity/EntityValidationTest.php
rename to core/tests/Drupal/KernelTests/Core/Entity/EntityValidationTest.php
index aa85fa7..2455360 100644
--- a/core/modules/system/src/Tests/Entity/EntityValidationTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Entity/EntityValidationTest.php
@@ -2,10 +2,10 @@
 
 /**
  * @file
- * Contains \Drupal\system\Tests\Entity\EntityValidationTest.
+ * Contains \Drupal\KernelTests\Core\Entity\EntityValidationTest.
  */
 
-namespace Drupal\system\Tests\Entity;
+namespace Drupal\KernelTests\Core\Entity;
 
 use Drupal\Core\Entity\Plugin\Validation\Constraint\CompositeConstraintBase;
 
@@ -14,7 +14,7 @@
  *
  * @group Entity
  */
-class EntityValidationTest extends EntityUnitTestBase {
+class EntityValidationTest extends EntityKernelTestBase {
 
   /**
    * Modules to enable.
diff --git a/core/modules/system/src/Tests/Entity/EntityViewBuilderTest.php b/core/tests/Drupal/KernelTests/Core/Entity/EntityViewBuilderTest.php
similarity index 98%
rename from core/modules/system/src/Tests/Entity/EntityViewBuilderTest.php
rename to core/tests/Drupal/KernelTests/Core/Entity/EntityViewBuilderTest.php
index a3e6cd1..60ac065 100644
--- a/core/modules/system/src/Tests/Entity/EntityViewBuilderTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Entity/EntityViewBuilderTest.php
@@ -2,10 +2,10 @@
 
 /**
  * @file
- * Contains \Drupal\system\Tests\Entity\EntityViewBuilderTest.
+ * Contains \Drupal\KernelTests\Core\Entity\EntityViewBuilderTest.
  */
 
-namespace Drupal\system\Tests\Entity;
+namespace Drupal\KernelTests\Core\Entity;
 
 use Drupal\Core\Language\LanguageInterface;
 use Drupal\field\Tests\EntityReference\EntityReferenceTestTrait;
@@ -18,7 +18,7 @@
  *
  * @group Entity
  */
-class EntityViewBuilderTest extends EntityUnitTestBase {
+class EntityViewBuilderTest extends EntityKernelTestBase {
 
   use EntityReferenceTestTrait;
 
diff --git a/core/modules/system/src/Tests/Entity/FieldSqlStorageTest.php b/core/tests/Drupal/KernelTests/Core/Entity/FieldSqlStorageTest.php
similarity index 98%
rename from core/modules/system/src/Tests/Entity/FieldSqlStorageTest.php
rename to core/tests/Drupal/KernelTests/Core/Entity/FieldSqlStorageTest.php
index 9f5028f..e2be94b 100644
--- a/core/modules/system/src/Tests/Entity/FieldSqlStorageTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Entity/FieldSqlStorageTest.php
@@ -2,16 +2,17 @@
 
 /**
  * @file
- * Contains \Drupal\system\Tests\Entity\FieldSqlStorageTest.
+ * Contains \Drupal\KernelTests\Core\Entity\FieldSqlStorageTest.
  */
 
-namespace Drupal\system\Tests\Entity;
+namespace Drupal\KernelTests\Core\Entity;
 
 use Drupal\Component\Utility\Unicode;
 use Drupal\Core\Database\Database;
 use Drupal\Core\Entity\Exception\FieldStorageDefinitionUpdateForbiddenException;
 use Drupal\field\Entity\FieldConfig;
 use Drupal\field\Entity\FieldStorageConfig;
+use Drupal\system\Tests\Entity\EntityUnitTestBase;
 
 /**
  * Tests Field SQL Storage .
@@ -21,7 +22,7 @@
  *
  * @group Entity
  */
-class FieldSqlStorageTest extends EntityUnitTestBase {
+class FieldSqlStorageTest extends EntityKernelTestBase {
 
   /**
    * Modules to enable.
diff --git a/core/modules/system/src/Tests/Entity/FieldTranslationSqlStorageTest.php b/core/tests/Drupal/KernelTests/Core/Entity/FieldTranslationSqlStorageTest.php
similarity index 95%
rename from core/modules/system/src/Tests/Entity/FieldTranslationSqlStorageTest.php
rename to core/tests/Drupal/KernelTests/Core/Entity/FieldTranslationSqlStorageTest.php
index 989f00b..0941a94 100644
--- a/core/modules/system/src/Tests/Entity/FieldTranslationSqlStorageTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Entity/FieldTranslationSqlStorageTest.php
@@ -2,14 +2,15 @@
 
 /**
  * @file
- * Contains \Drupal\system\Tests\Entity\FieldTranslationSqlStorageTest.
+ * Contains \Drupal\KernelTests\Core\Entity\FieldTranslationSqlStorageTest.
  */
 
-namespace Drupal\system\Tests\Entity;
+namespace Drupal\KernelTests\Core\Entity;
 
 use Drupal\Core\Entity\FieldableEntityInterface;
 use Drupal\Core\Language\LanguageInterface;
 use Drupal\field\Entity\FieldStorageConfig;
+use Drupal\KernelTests\Core\Entity\EntityLanguageTestBase;
 
 /**
  * Tests Field translation SQL Storage.
diff --git a/core/modules/system/src/Tests/Entity/FieldWidgetConstraintValidatorTest.php b/core/tests/Drupal/KernelTests/Core/Entity/FieldWidgetConstraintValidatorTest.php
similarity index 97%
rename from core/modules/system/src/Tests/Entity/FieldWidgetConstraintValidatorTest.php
rename to core/tests/Drupal/KernelTests/Core/Entity/FieldWidgetConstraintValidatorTest.php
index 68bfee6..c8eebf4 100644
--- a/core/modules/system/src/Tests/Entity/FieldWidgetConstraintValidatorTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Entity/FieldWidgetConstraintValidatorTest.php
@@ -2,16 +2,16 @@
 
 /**
  * @file
- * Contains \Drupal\system\Tests\Entity\FieldWidgetConstraintValidatorTest.
+ * Contains \Drupal\KernelTests\Core\Entity\FieldWidgetConstraintValidatorTest.
  */
 
-namespace Drupal\system\Tests\Entity;
+namespace Drupal\KernelTests\Core\Entity;
 
 use Drupal\Component\Utility\SafeMarkup;
 use Drupal\Core\Entity\EntityInterface;
 use Drupal\Core\Form\FormState;
 use Drupal\entity_test\Entity\EntityTestCompositeConstraint;
-use Drupal\simpletest\KernelTestBase;
+use Drupal\KernelTests\KernelTestBase;
 use Drupal\system\Tests\TypedData;
 
 /**
diff --git a/core/modules/system/src/Tests/Entity/ValidReferenceConstraintValidatorTest.php b/core/tests/Drupal/KernelTests/Core/Entity/ValidReferenceConstraintValidatorTest.php
similarity index 91%
rename from core/modules/system/src/Tests/Entity/ValidReferenceConstraintValidatorTest.php
rename to core/tests/Drupal/KernelTests/Core/Entity/ValidReferenceConstraintValidatorTest.php
index 69a7acb..0772447 100644
--- a/core/modules/system/src/Tests/Entity/ValidReferenceConstraintValidatorTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Entity/ValidReferenceConstraintValidatorTest.php
@@ -2,10 +2,10 @@
 
 /**
  * @file
- * Contains \Drupal\system\Tests\Entity\ValidReferenceConstraintValidatorTest.
+ * Contains \Drupal\KernelTests\Core\Entity\ValidReferenceConstraintValidatorTest.
  */
 
-namespace Drupal\system\Tests\Entity;
+namespace Drupal\KernelTests\Core\Entity;
 
 use Drupal\Core\Field\BaseFieldDefinition;
 use Drupal\system\Tests\TypedData;
@@ -15,7 +15,7 @@
  *
  * @group Validation
  */
-class ValidReferenceConstraintValidatorTest extends EntityUnitTestBase {
+class ValidReferenceConstraintValidatorTest extends EntityKernelTestBase {
 
   /**
    * The typed data manager to use.
diff --git a/core/modules/system/src/Tests/Entity/FieldAccessTest.php b/core/tests/Drupal/KernelTests/Core/Field/FieldAccessTest.php
similarity index 96%
rename from core/modules/system/src/Tests/Entity/FieldAccessTest.php
rename to core/tests/Drupal/KernelTests/Core/Field/FieldAccessTest.php
index a6a677f..5ef2d43 100644
--- a/core/modules/system/src/Tests/Entity/FieldAccessTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Field/FieldAccessTest.php
@@ -2,10 +2,10 @@
 
 /**
  * @file
- * Contains \Drupal\system\Tests\Entity\FieldAccessTest.
+ * Contains \Drupal\KernelTests\Core\Field\FieldAccessTest.
  */
 
-namespace Drupal\system\Tests\Entity;
+namespace Drupal\KernelTests\Core\Field;
 
 use Drupal\Core\Access\AccessResult;
 use Drupal\entity_test\Entity\EntityTest;
diff --git a/core/modules/system/src/Tests/Field/FieldItemTest.php b/core/tests/Drupal/KernelTests/Core/Field/FieldItemTest.php
similarity index 97%
rename from core/modules/system/src/Tests/Field/FieldItemTest.php
rename to core/tests/Drupal/KernelTests/Core/Field/FieldItemTest.php
index 0bb09ea..69e7f7f 100644
--- a/core/modules/system/src/Tests/Field/FieldItemTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Field/FieldItemTest.php
@@ -2,10 +2,10 @@
 
 /**
  * @file
- * Contains \Drupal\system\Tests\Field\FieldItemTest.
+ * Contains \Drupal\KernelTests\Core\Field\FieldItemTest.
  */
 
-namespace Drupal\system\Tests\Field;
+namespace Drupal\KernelTests\Core\Field;
 
 use Drupal\Component\Utility\Unicode;
 use Drupal\entity_test\Entity\EntityTest;
diff --git a/core/modules/system/src/Tests/Field/FieldModuleUninstallValidatorTest.php b/core/tests/Drupal/Tests/Core/Field/FieldModuleUninstallValidatorTest.php
similarity index 97%
rename from core/modules/system/src/Tests/Field/FieldModuleUninstallValidatorTest.php
rename to core/tests/Drupal/Tests/Core/Field/FieldModuleUninstallValidatorTest.php
index 2d7c160..6bbfd88 100644
--- a/core/modules/system/src/Tests/Field/FieldModuleUninstallValidatorTest.php
+++ b/core/tests/Drupal/Tests/Core/Field/FieldModuleUninstallValidatorTest.php
@@ -2,10 +2,10 @@
 
 /**
  * @file
- * Contains \Drupal\system\Tests\Field\FieldModuleUninstallValidatorTest.
+ * Contains \Drupal\KernelTests\Core\Field\FieldModuleUninstallValidatorTest.
  */
 
-namespace Drupal\system\Tests\Field;
+namespace Drupal\KernelTests\Core\Field;
 
 use Drupal\Core\Extension\ModuleUninstallValidatorException;
 use Drupal\Core\Field\BaseFieldDefinition;
