diff --git a/core/lib/Drupal/Core/Entity/ContentEntityStorageBase.php b/core/lib/Drupal/Core/Entity/ContentEntityStorageBase.php
index 9d6b8d64f5..32cbcfb6be 100644
--- a/core/lib/Drupal/Core/Entity/ContentEntityStorageBase.php
+++ b/core/lib/Drupal/Core/Entity/ContentEntityStorageBase.php
@@ -4,6 +4,7 @@
 
 use Drupal\Core\Cache\Cache;
 use Drupal\Core\Cache\CacheBackendInterface;
+use Drupal\Core\Entity\Exception\MissingEntityBundleException;
 use Drupal\Core\Field\FieldDefinitionInterface;
 use Drupal\Core\Field\FieldStorageDefinitionInterface;
 use Symfony\Component\DependencyInjection\ContainerInterface;
@@ -90,6 +91,41 @@ protected function doCreate(array $values) {
   }
 
   /**
+   * {@inheritdoc}
+   */
+  public function createWithSampleValues($bundle, array $values = []) {
+    $bundle_type = $this->entityType->getBundleEntityType();
+    if (!$bundle_type && $bundle != $this->entityTypeId) {
+      $bundle = $this->entityTypeId;
+    }
+    if ($bundle_type) {
+      $bundle_type = $this->entityManager->getStorage($bundle_type);
+      $bundle_entity = $bundle_type->load($bundle);
+      if (!$bundle_entity) {
+        throw new MissingEntityBundleException($bundle);
+      }
+    }
+    $bundle_key = $this->entityType->getKey('bundle');
+    $values[$bundle_key] = $bundle;
+    // Bundle is already set, and ID and revision should never be set.
+    $forbidden_keys = [
+      $this->entityType->getKey('id'),
+      $this->entityType->getKey('revision'),
+      $bundle_key
+    ];
+    // Forbid sample generation on any keys whose values were submitted.
+    $forbidden_keys = array_merge($forbidden_keys, array_keys($values));
+    /** @var \Drupal\Core\Entity\FieldableEntityInterface $entity */
+    $entity = $this->create($values);
+    foreach ($entity as $field_name => $value) {
+      if (!in_array($field_name, $forbidden_keys)) {
+        $entity->get($field_name)->generateSampleItems();
+      }
+    }
+    return $entity;
+  }
+
+  /**
    * Initializes field values.
    *
    * @param \Drupal\Core\Entity\ContentEntityInterface $entity
diff --git a/core/lib/Drupal/Core/Entity/ContentEntityStorageInterface.php b/core/lib/Drupal/Core/Entity/ContentEntityStorageInterface.php
index 47e058d8e1..f851723758 100644
--- a/core/lib/Drupal/Core/Entity/ContentEntityStorageInterface.php
+++ b/core/lib/Drupal/Core/Entity/ContentEntityStorageInterface.php
@@ -23,4 +23,21 @@
    */
   public function createTranslation(ContentEntityInterface $entity, $langcode, array $values = []);
 
+
+  /**
+   * Creates an entity with sample field values.
+   *
+   * @param string $bundle
+   *   The entity bundle.
+   * @param array $values
+   *   (optional) Any default values to use during generation.
+   *
+   * @return \Drupal\Core\Entity\FieldableEntityInterface
+   *   A fieldable content entity.
+   *
+   * @throws \Drupal\Core\Entity\Exception\MissingEntityBundleException
+   *   Thrown if the requested entity bundle does not exist.
+   */
+  public function createWithSampleValues($bundle, array $values = []);
+
 }
diff --git a/core/lib/Drupal/Core/Entity/Exception/MissingEntityBundleException.php b/core/lib/Drupal/Core/Entity/Exception/MissingEntityBundleException.php
new file mode 100644
index 0000000000..a26682b770
--- /dev/null
+++ b/core/lib/Drupal/Core/Entity/Exception/MissingEntityBundleException.php
@@ -0,0 +1,29 @@
+<?php
+
+namespace Drupal\Core\Entity\Exception;
+
+/**
+ * Exception thrown when requested entity bundle does not exist.
+ *
+ * @see \Drupal\Core\Entity\ContentEntityStorageBase::createWithSampleValues
+ */
+class MissingEntityBundleException extends \Exception {
+
+  /**
+   * Constructs an MissingEntityBundleException.
+   *
+   * For the remaining parameters see \Exception.
+   *
+   * @param string $bundle
+   *   The entity bundle.
+   *
+   * @see \Exception
+   */
+  public function __construct($bundle, $message = '', $code = 0, \Exception $previous = NULL) {
+    if (empty($message)) {
+      $message = sprintf("Missing entity bundle. The \"%s\" bundle does not exist", $bundle);
+    }
+    parent::__construct($message, $code, $previous);
+  }
+
+}
diff --git a/core/lib/Drupal/Core/Field/FieldItemList.php b/core/lib/Drupal/Core/Field/FieldItemList.php
index a1a1ebdb9e..5d13a5e5cc 100644
--- a/core/lib/Drupal/Core/Field/FieldItemList.php
+++ b/core/lib/Drupal/Core/Field/FieldItemList.php
@@ -259,7 +259,7 @@ public function view($display_options = []) {
    */
   public function generateSampleItems($count = 1) {
     $field_definition = $this->getFieldDefinition();
-    $field_type_class = \Drupal::service('plugin.manager.field.field_type')->getPluginClass($field_definition->getType());
+    $field_type_class = $field_definition->getItemDefinition()->getClass();
     for ($delta = 0; $delta < $count; $delta++) {
       $values[$delta] = $field_type_class::generateSampleValue($field_definition);
     }
diff --git a/core/modules/user/src/Entity/User.php b/core/modules/user/src/Entity/User.php
index 7529532581..f254ccff93 100644
--- a/core/modules/user/src/Entity/User.php
+++ b/core/modules/user/src/Entity/User.php
@@ -9,6 +9,7 @@
 use Drupal\Core\Field\BaseFieldDefinition;
 use Drupal\Core\Language\LanguageInterface;
 use Drupal\user\RoleInterface;
+use Drupal\user\TimeZoneItem;
 use Drupal\user\UserInterface;
 
 /**
@@ -498,6 +499,7 @@ public static function baseFieldDefinitions(EntityTypeInterface $entity_type) {
       ->addPropertyConstraints('value', [
         'AllowedValues' => ['callback' => __CLASS__ . '::getAllowedTimezones'],
       ]);
+    $fields['timezone']->getItemDefinition()->setClass(TimeZoneItem::class);
 
     $fields['status'] = BaseFieldDefinition::create('boolean')
       ->setLabel(t('User status'))
diff --git a/core/modules/user/src/TimeZoneItem.php b/core/modules/user/src/TimeZoneItem.php
new file mode 100644
index 0000000000..693d1cc2ac
--- /dev/null
+++ b/core/modules/user/src/TimeZoneItem.php
@@ -0,0 +1,24 @@
+<?php
+
+namespace Drupal\user;
+
+use Drupal\Core\Field\FieldDefinitionInterface;
+use Drupal\Core\Field\Plugin\Field\FieldType\StringItem;
+use Drupal\user\Entity\User;
+
+/**
+ * Defines a custom field item class for the 'timezone' user entity field.
+ */
+class TimeZoneItem extends StringItem {
+
+  /**
+   * {@inheritdoc}
+   */
+  public static function generateSampleValue(FieldDefinitionInterface $field_definition) {
+    $timezones = User::getAllowedTimezones();
+    // We need to vary the selected timezones since we're generating a sample.
+    $key = rand(0, count($timezones));
+    return $timezones[$key];
+  }
+
+}
diff --git a/core/modules/user/src/UserNameItem.php b/core/modules/user/src/UserNameItem.php
index 6a53eb5d06..e6a0f2d420 100644
--- a/core/modules/user/src/UserNameItem.php
+++ b/core/modules/user/src/UserNameItem.php
@@ -2,6 +2,7 @@
 
 namespace Drupal\user;
 
+use Drupal\Core\Field\FieldDefinitionInterface;
 use Drupal\Core\Field\Plugin\Field\FieldType\StringItem;
 
 /**
@@ -23,4 +24,14 @@ public function isEmpty() {
     return $value === NULL || $value === '';
   }
 
+  /**
+   * {@inheritdoc}
+   */
+  public static function generateSampleValue(FieldDefinitionInterface $field_definition) {
+    $values = parent::generateSampleValue($field_definition);
+    // User names larger than 60 characters won't pass validation.
+    $values['value'] = substr($values['value'], 0, UserInterface::USERNAME_MAX_LENGTH);
+    return $values;
+  }
+
 }
diff --git a/core/modules/user/tests/src/Kernel/UserEntityTest.php b/core/modules/user/tests/src/Kernel/UserEntityTest.php
index 1c501f049e..73fe869ec3 100644
--- a/core/modules/user/tests/src/Kernel/UserEntityTest.php
+++ b/core/modules/user/tests/src/Kernel/UserEntityTest.php
@@ -22,6 +22,14 @@ class UserEntityTest extends KernelTestBase {
   public static $modules = ['system', 'user', 'field'];
 
   /**
+   * {@inheritdoc}
+   */
+  protected function setUp() {
+    parent::setUp();
+    $this->installEntitySchema('user');
+  }
+
+  /**
    * Tests some of the methods.
    *
    * @see \Drupal\user\Entity\User::getRoles()
@@ -65,4 +73,22 @@ public function testUserMethods() {
     $this->assertEqual([RoleInterface::AUTHENTICATED_ID, 'test_role_two'], $user->getRoles());
   }
 
+  /**
+   * Tests that all user fields validate properly.
+   *
+   * @see \Drupal\Core\Field\FieldItemListInterface::generateSampleItems
+   * @see \Drupal\Core\Field\FieldItemInterface::generateSampleValue()
+   * @see \Drupal\Core\Entity\FieldableEntityInterface::validate()
+   */
+  public function testUserValidation() {
+    $user = User::create([]);
+    foreach ($user as $field_name => $field) {
+      if (!in_array($field_name, ['uid'])) {
+        $user->$field_name->generateSampleItems();
+      }
+    }
+    $violations = $user->validate();
+    $this->assertFalse((bool) $violations->count());
+  }
+
 }
diff --git a/core/tests/Drupal/KernelTests/Core/Entity/Element/CreateSampleEntityTest.php b/core/tests/Drupal/KernelTests/Core/Entity/Element/CreateSampleEntityTest.php
new file mode 100644
index 0000000000..4217d7af94
--- /dev/null
+++ b/core/tests/Drupal/KernelTests/Core/Entity/Element/CreateSampleEntityTest.php
@@ -0,0 +1,77 @@
+<?php
+
+namespace Drupal\KernelTests\Core\Entity\Element;
+
+use Drupal\Core\Entity\FieldableEntityInterface;
+use Drupal\KernelTests\KernelTestBase;
+use Drupal\node\Entity\NodeType;
+use Drupal\taxonomy\Entity\Vocabulary;
+
+/**
+ * Tests the EntityGenerator API.
+ *
+ * @coversDefaultClass \Drupal\Core\Entity\ContentEntityStorageBase
+ * @group Entity
+ */
+class CreateSampleEntityTest extends KernelTestBase {
+
+  /**
+   * The entity type manager.
+   *
+   * @var \Drupal\Core\Entity\EntityTypeManagerInterface
+   */
+  protected $entityTypeManager;
+
+  /**
+   * {@inheritdoc}
+   */
+  public static $modules = ['system', 'field', 'filter', 'text', 'file', 'user', 'node', 'comment', 'taxonomy'];
+
+  /**
+   * {@inheritdoc}
+   */
+  protected function setUp() {
+    parent::setup();
+
+    $this->installEntitySchema('file');
+    $this->installEntitySchema('user');
+    $this->installEntitySchema('node');
+    $this->installEntitySchema('node_type');
+    $this->installEntitySchema('file');
+    $this->installEntitySchema('comment');
+    $this->installEntitySchema('comment_type');
+    $this->installEntitySchema('taxonomy_vocabulary');
+    $this->installEntitySchema('taxonomy_term');
+    $this->entityTypeManager = $this->container->get('entity_type.manager');
+    NodeType::create(['type' => 'article', 'name' => 'Article'])->save();
+    NodeType::create(['type' => 'page', 'name' => 'Page'])->save();
+    Vocabulary::create(['name' => 'Tags', 'vid' => 'tags'])->save();
+  }
+
+  /**
+   * Tests generation of all enabled content entity types.
+   *
+   * * @covers ::createWithSampleValues
+   */
+  public function testGenerateContentEntity() {
+    foreach ($this->entityTypeManager->getDefinitions() as $entity_type_id => $definition) {
+      if ($definition->entityClassImplements(FieldableEntityInterface::class)) {
+        // Create sample entities with bundles.
+        if ($bundle_type = $definition->getBundleEntityType()) {
+          foreach ($this->entityTypeManager->getStorage($bundle_type)->loadMultiple() as $bundle) {
+            $entity = $this->entityTypeManager->getStorage($entity_type_id)->createWithSampleValues($bundle->id());
+            $violations = $entity->validate();
+            $this->assertEquals(0, $violations->count());
+          }
+        }
+        // Create sample entities without bundles.
+        else {
+          $entity = $this->entityTypeManager->getStorage($entity_type_id)->createWithSampleValues($entity_type_id);
+          $violations = $entity->validate();
+          $this->assertEquals(0, $violations->count());
+        }
+      }
+    }
+  }
+
+}
