diff --git a/core/modules/comment/src/CommentManager.php b/core/modules/comment/src/CommentManager.php
index e1a6f5f..2777da1 100644
--- a/core/modules/comment/src/CommentManager.php
+++ b/core/modules/comment/src/CommentManager.php
@@ -116,99 +116,6 @@ public function getFields($entity_type_id) {
   /**
    * {@inheritdoc}
    */
-  public function addDefaultField($entity_type, $bundle, $field_name = 'comment', $default_value = CommentItemInterface::OPEN, $comment_type_id = 'comment') {
-    // Create the comment type if needed.
-    $comment_type_storage = $this->entityManager->getStorage('comment_type');
-    if ($comment_type = $comment_type_storage->load($comment_type_id)) {
-      if ($comment_type->getTargetEntityTypeId() !== $entity_type) {
-        throw new \InvalidArgumentException(String::format('The given comment type id %id can only be used with the %entity_type entity type', array(
-          '%id' => $comment_type_id,
-          '%entity_type' => $entity_type,
-        )));
-      }
-    }
-    else {
-      $comment_type_storage->create(array(
-        'id' => $comment_type_id,
-        'label' => Unicode::ucfirst($comment_type_id),
-        'target_entity_type_id' => $entity_type,
-        'description' => 'Default comment field',
-      ))->save();
-    }
-    // Add a body field to the comment type.
-    $this->addBodyField($comment_type_id);
-
-    // Add a comment field to the host entity type. Create the field storage if
-    // needed.
-    if (!array_key_exists($field_name, $this->entityManager->getFieldStorageDefinitions($entity_type))) {
-      $this->entityManager->getStorage('field_storage_config')->create(array(
-        'entity_type' => $entity_type,
-        'field_name' => $field_name,
-        'type' => 'comment',
-        'translatable' => TRUE,
-        'settings' => array(
-          'comment_type' => $comment_type_id,
-        ),
-      ))->save();
-    }
-    // Create the field if needed, and configure its form and view displays.
-    if (!array_key_exists($field_name, $this->entityManager->getFieldDefinitions($entity_type, $bundle))) {
-      $this->entityManager->getStorage('field_config')->create(array(
-        'label' => 'Comments',
-        'description' => '',
-        'field_name' => $field_name,
-        'entity_type' => $entity_type,
-        'bundle' => $bundle,
-        'required' => 1,
-        'default_value' => array(
-          array(
-            'status' => $default_value,
-            'cid' => 0,
-            'last_comment_name' => '',
-            'last_comment_timestamp' => 0,
-            'last_comment_uid' => 0,
-          ),
-        ),
-      ))->save();
-
-      // Entity form displays: assign widget settings for the 'default' form
-      // mode, and hide the field in all other form modes.
-      entity_get_form_display($entity_type, $bundle, 'default')
-        ->setComponent($field_name, array(
-          'type' => 'comment_default',
-          'weight' => 20,
-        ))
-        ->save();
-      foreach ($this->entityManager->getFormModes($entity_type) as $id => $form_mode) {
-        $display = entity_get_form_display($entity_type, $bundle, $id);
-        // Only update existing displays.
-        if ($display && !$display->isNew()) {
-          $display->removeComponent($field_name)->save();
-        }
-      }
-
-      // Entity view displays: assign widget settings for the 'default' view
-      // mode, and hide the field in all other view modes.
-      entity_get_display($entity_type, $bundle, 'default')
-        ->setComponent($field_name, array(
-          'label' => 'above',
-          'type' => 'comment_default',
-          'weight' => 20,
-        ))
-        ->save();
-      foreach ($this->entityManager->getViewModes($entity_type) as $id => $view_mode) {
-        $display = entity_get_display($entity_type, $bundle, $id);
-        // Only update existing displays.
-        if ($display && !$display->isNew()) {
-          $display->removeComponent($field_name)->save();
-        }
-      }
-    }
-  }
-
-  /**
-   * {@inheritdoc}
-   */
   public function addBodyField($comment_type_id) {
     if (!FieldConfig::loadByName('comment', $comment_type_id, 'comment_body')) {
       // Attaches the body field by default.
diff --git a/core/modules/comment/src/CommentManagerInterface.php b/core/modules/comment/src/CommentManagerInterface.php
index 0f00351..2c9a531 100644
--- a/core/modules/comment/src/CommentManagerInterface.php
+++ b/core/modules/comment/src/CommentManagerInterface.php
@@ -44,28 +44,6 @@
   public function getFields($entity_type_id);
 
   /**
-   * Utility method to add the default comment field to an entity.
-   *
-   * Attaches a comment field named 'comment' to the given entity type and
-   * bundle. Largely replicates the default behavior in Drupal 7 and earlier.
-   *
-   * @param string $entity_type
-   *   The entity type to attach the default comment field to.
-   * @param string $bundle
-   *   The bundle to attach the default comment field to.
-   * @param string $field_name
-   *   (optional) Field name to use for the comment field. Defaults to
-   *     'comment'.
-   * @param int $default_value
-   *   (optional) Default value, one of CommentItemInterface::HIDDEN,
-   *   CommentItemInterface::OPEN, CommentItemInterface::CLOSED. Defaults to
-   *   CommentItemInterface::OPEN.
-   * @param string $comment_type_id
-   *   (optional) ID of comment type to use. Defaults to 'comment'.
-   */
-  public function addDefaultField($entity_type, $bundle, $field_name = 'comment', $default_value = CommentItemInterface::OPEN, $comment_type_id = 'comment');
-
-  /**
    * Creates a comment_body field.
    *
    * @param string $comment_type
diff --git a/core/modules/comment/src/Tests/CommentBookTest.php b/core/modules/comment/src/Tests/CommentBookTest.php
index eb20e68..ecc2624 100644
--- a/core/modules/comment/src/Tests/CommentBookTest.php
+++ b/core/modules/comment/src/Tests/CommentBookTest.php
@@ -17,6 +17,8 @@
  */
 class CommentBookTest extends WebTestBase {
 
+  use CommentTestTrait;
+
   /**
    * Modules to install.
    *
@@ -28,7 +30,7 @@ protected function setUp() {
     parent::setUp();
 
     // Create comment field on book.
-    \Drupal::service('comment.manager')->addDefaultField('node', 'book');
+    $this->addDefaultCommentField('node', 'book');
   }
 
   /**
diff --git a/core/modules/comment/src/Tests/CommentCacheTagsTest.php b/core/modules/comment/src/Tests/CommentCacheTagsTest.php
index 6f83dbf..3874ba6 100644
--- a/core/modules/comment/src/Tests/CommentCacheTagsTest.php
+++ b/core/modules/comment/src/Tests/CommentCacheTagsTest.php
@@ -20,6 +20,8 @@
  */
 class CommentCacheTagsTest extends EntityWithUriCacheTagsTestBase {
 
+  use CommentTestTrait;
+
   /**
    * {@inheritdoc}
    */
@@ -47,7 +49,7 @@ protected function createEntity() {
     entity_test_create_bundle($bundle, NULL, 'entity_test');
 
     // Create a comment field on this bundle.
-    \Drupal::service('comment.manager')->addDefaultField('entity_test', 'bar', 'comment');
+    $this->addDefaultCommentField('entity_test', 'bar', 'comment');
 
     // Display comments in a flat list; threaded comments are not render cached.
     $field = FieldConfig::loadByName('entity_test', 'bar', 'comment');
diff --git a/core/modules/comment/src/Tests/CommentDefaultFormatterCacheTagsTest.php b/core/modules/comment/src/Tests/CommentDefaultFormatterCacheTagsTest.php
index 1a97e1b..763d106 100644
--- a/core/modules/comment/src/Tests/CommentDefaultFormatterCacheTagsTest.php
+++ b/core/modules/comment/src/Tests/CommentDefaultFormatterCacheTagsTest.php
@@ -19,6 +19,8 @@
  */
 class CommentDefaultFormatterCacheTagsTest extends EntityUnitTestBase {
 
+  use CommentTestTrait;
+
   /**
    * Modules to install.
    *
@@ -48,7 +50,7 @@ protected function setUp() {
 
     // Set up a field, so that the entity that'll be referenced bubbles up a
     // cache tag when rendering it entirely.
-    \Drupal::service('comment.manager')->addDefaultField('entity_test', 'entity_test');
+    $this->addDefaultCommentField('entity_test', 'entity_test');
   }
 
   /**
diff --git a/core/modules/comment/src/Tests/CommentFieldAccessTest.php b/core/modules/comment/src/Tests/CommentFieldAccessTest.php
index c6cd2d2..78e5146 100644
--- a/core/modules/comment/src/Tests/CommentFieldAccessTest.php
+++ b/core/modules/comment/src/Tests/CommentFieldAccessTest.php
@@ -24,6 +24,8 @@
  */
 class CommentFieldAccessTest extends EntityUnitTestBase {
 
+  use CommentTestTrait;
+
   /**
    * Modules to install.
    *
@@ -126,11 +128,9 @@ public function testAccessToAdministrativeFields() {
 
     $anonymous_user = new AnonymousUserSession();
 
-    /** @var \Drupal\comment\CommentManagerInterface $manager */
-    $manager = \Drupal::service('comment.manager');
     // Add two fields.
-    $manager->addDefaultField('entity_test', 'entity_test', 'comment');
-    $manager->addDefaultField('entity_test', 'entity_test', 'comment_other');
+    $this->addDefaultCommentField('entity_test', 'entity_test', 'comment');
+    $this->addDefaultCommentField('entity_test', 'entity_test', 'comment_other');
 
     // Change the second field's anonymous contact setting.
     $instance = FieldConfig::loadByName('entity_test', 'entity_test', 'comment_other');
diff --git a/core/modules/comment/src/Tests/CommentFieldsTest.php b/core/modules/comment/src/Tests/CommentFieldsTest.php
index 1ded5d1..c7e5eec 100644
--- a/core/modules/comment/src/Tests/CommentFieldsTest.php
+++ b/core/modules/comment/src/Tests/CommentFieldsTest.php
@@ -32,7 +32,7 @@ function testCommentDefaultFields() {
     // Do not make assumptions on default node types created by the test
     // installation profile, and create our own.
     $this->drupalCreateContentType(array('type' => 'test_node_type'));
-    $this->container->get('comment.manager')->addDefaultField('node', 'test_node_type');
+    $this->addDefaultCommentField('node', 'test_node_type');
 
     // Check that the 'comment_body' field is present on the comment bundle.
     $field = FieldConfig::loadByName('comment', 'comment', 'comment_body');
@@ -48,7 +48,7 @@ function testCommentDefaultFields() {
     // Create a new content type.
     $type_name = 'test_node_type_2';
     $this->drupalCreateContentType(array('type' => $type_name));
-    $this->container->get('comment.manager')->addDefaultField('node', $type_name);
+    $this->addDefaultCommentField('node', $type_name);
 
     // Check that the 'comment_body' field exists and has an instance on the
     // new comment bundle.
@@ -58,7 +58,7 @@ function testCommentDefaultFields() {
     $this->assertTrue(isset($field), format_string('The comment_body field is present for comments on type @type', array('@type' => $type_name)));
 
     // Test adding a field that defaults to CommentItemInterface::CLOSED.
-    $this->container->get('comment.manager')->addDefaultField('node', 'test_node_type', 'who_likes_ponies', CommentItemInterface::CLOSED, 'who_likes_ponies');
+    $this->addDefaultCommentField('node', 'test_node_type', 'who_likes_ponies', CommentItemInterface::CLOSED, 'who_likes_ponies');
     $field = FieldConfig::load('node.test_node_type.who_likes_ponies');
     $this->assertEqual($field->default_value[0]['status'], CommentItemInterface::CLOSED);
   }
@@ -68,11 +68,11 @@ function testCommentDefaultFields() {
    */
   public function testCommentFieldDelete() {
     $this->drupalCreateContentType(array('type' => 'test_node_type'));
-    $this->container->get('comment.manager')->addDefaultField('node', 'test_node_type');
+    $this->addDefaultCommentField('node', 'test_node_type');
     // We want to test the handling of removing the primary comment field, so we
     // ensure there is at least one other comment field attached to a node type
     // so that comment_entity_load() runs for nodes.
-    $this->container->get('comment.manager')->addDefaultField('node', 'test_node_type', 'comment2');
+    $this->addDefaultCommentField('node', 'test_node_type', 'comment2');
 
     // Create a sample node.
     $node = $this->drupalCreateNode(array(
@@ -132,7 +132,7 @@ function testCommentInstallAfterContentModule() {
     $this->assertTrue($this->container->get('module_handler')->moduleExists('comment'), 'Comment module enabled.');
 
     // Create nodes of each type.
-    $this->container->get('comment.manager')->addDefaultField('node', 'book');
+    $this->addDefaultCommentField('node', 'book');
     $book_node = $this->drupalCreateNode(array('type' => 'book'));
 
     $this->drupalLogout();
diff --git a/core/modules/comment/src/Tests/CommentLanguageTest.php b/core/modules/comment/src/Tests/CommentLanguageTest.php
index ab70e7d..92f610e 100644
--- a/core/modules/comment/src/Tests/CommentLanguageTest.php
+++ b/core/modules/comment/src/Tests/CommentLanguageTest.php
@@ -19,6 +19,8 @@
  */
 class CommentLanguageTest extends WebTestBase {
 
+  use CommentTestTrait;
+
   /**
    * Modules to install.
    *
@@ -67,7 +69,7 @@ protected function setUp() {
     $this->drupalPostForm("user/" . $admin_user->id() . "/edit", $edit, t('Save'));
 
     // Create comment field on article.
-    $this->container->get('comment.manager')->addDefaultField('node', 'article');
+    $this->addDefaultCommentField('node', 'article');
 
     // Make comment body translatable.
     $field_storage = FieldStorageConfig::loadByName('comment', 'comment_body');
diff --git a/core/modules/comment/src/Tests/CommentNonNodeTest.php b/core/modules/comment/src/Tests/CommentNonNodeTest.php
index 9a9f48e..73fa8e2 100644
--- a/core/modules/comment/src/Tests/CommentNonNodeTest.php
+++ b/core/modules/comment/src/Tests/CommentNonNodeTest.php
@@ -24,6 +24,7 @@
 class CommentNonNodeTest extends WebTestBase {
 
   use FieldUiTestTrait;
+  use CommentTestTrait;
 
   public static $modules = array('comment', 'user', 'field_ui', 'entity_test', 'block');
 
@@ -50,7 +51,7 @@ protected function setUp() {
       'target_entity_type_id' => 'entity_test',
     ))->save();
     // Create comment field on entity_test bundle.
-    $this->container->get('comment.manager')->addDefaultField('entity_test', 'entity_test');
+    $this->addDefaultCommentField('entity_test', 'entity_test');
 
     // Verify that bundles are defined correctly.
     $bundles = \Drupal::entityManager()->getBundleInfo('comment');
diff --git a/core/modules/comment/src/Tests/CommentPagerTest.php b/core/modules/comment/src/Tests/CommentPagerTest.php
index 18bb32d..2b30502 100644
--- a/core/modules/comment/src/Tests/CommentPagerTest.php
+++ b/core/modules/comment/src/Tests/CommentPagerTest.php
@@ -273,7 +273,7 @@ function testCommentNewPageIndicator() {
    */
   function testTwoPagers() {
     // Add another field to article content-type.
-    $this->container->get('comment.manager')->addDefaultField('node', 'article', 'comment_2');
+    $this->addDefaultCommentField('node', 'article', 'comment_2');
     // Set default to display comment list with unique pager id.
     entity_get_display('node', 'article', 'default')
       ->setComponent('comment_2', array(
diff --git a/core/modules/comment/src/Tests/CommentTestBase.php b/core/modules/comment/src/Tests/CommentTestBase.php
index 5acb24a..7b1f7e0 100644
--- a/core/modules/comment/src/Tests/CommentTestBase.php
+++ b/core/modules/comment/src/Tests/CommentTestBase.php
@@ -19,6 +19,8 @@
  */
 abstract class CommentTestBase extends WebTestBase {
 
+  use CommentTestTrait;
+
   /**
    * Modules to install.
    *
@@ -79,7 +81,7 @@ protected function setUp() {
     ));
 
     // Create comment field on article.
-    $this->container->get('comment.manager')->addDefaultField('node', 'article');
+    $this->addDefaultCommentField('node', 'article');
 
     // Create a test node authored by the web user.
     $this->node = $this->drupalCreateNode(array('type' => 'article', 'promote' => 1, 'uid' => $this->webUser->id()));
diff --git a/core/modules/comment/src/Tests/CommentTestTrait.php b/core/modules/comment/src/Tests/CommentTestTrait.php
new file mode 100644
index 0000000..bca6d5d
--- /dev/null
+++ b/core/modules/comment/src/Tests/CommentTestTrait.php
@@ -0,0 +1,130 @@
+<?php
+
+/**
+ * @file
+ * Contains \Drupal\comment\Tests\CommentTestTrait.
+ */
+
+namespace Drupal\comment\Tests;
+
+use Drupal\Component\Utility\String;
+use Drupal\Component\Utility\Unicode;
+use Drupal\comment\Plugin\Field\FieldType\CommentItemInterface;
+
+/**
+ * Provides common functionality for the Comment test classes.
+ */
+trait CommentTestTrait {
+
+  /**
+   * Adds the default comment field to an entity.
+   *
+   * Attaches a comment field named 'comment' to the given entity type and
+   * bundle. Largely replicates the default behavior in Drupal 7 and earlier.
+   *
+   * @param string $entity_type
+   *   The entity type to attach the default comment field to.
+   * @param string $bundle
+   *   The bundle to attach the default comment field to.
+   * @param string $field_name
+   *   (optional) Field name to use for the comment field. Defaults to
+   *     'comment'.
+   * @param int $default_value
+   *   (optional) Default value, one of CommentItemInterface::HIDDEN,
+   *   CommentItemInterface::OPEN, CommentItemInterface::CLOSED. Defaults to
+   *   CommentItemInterface::OPEN.
+   * @param string $comment_type_id
+   *   (optional) ID of comment type to use. Defaults to 'comment'.
+   */
+  public function addDefaultCommentField($entity_type, $bundle, $field_name = 'comment', $default_value = CommentItemInterface::OPEN, $comment_type_id = 'comment') {
+    $entity_manager = \Drupal::entityManager();
+    // Create the comment type if needed.
+    $comment_type_storage = $entity_manager->getStorage('comment_type');
+    if ($comment_type = $comment_type_storage->load($comment_type_id)) {
+      if ($comment_type->getTargetEntityTypeId() !== $entity_type) {
+        throw new \InvalidArgumentException(String::format('The given comment type id %id can only be used with the %entity_type entity type', array(
+          '%id' => $comment_type_id,
+          '%entity_type' => $entity_type,
+        )));
+      }
+    }
+    else {
+      $comment_type_storage->create(array(
+        'id' => $comment_type_id,
+        'label' => Unicode::ucfirst($comment_type_id),
+        'target_entity_type_id' => $entity_type,
+        'description' => 'Default comment field',
+      ))->save();
+    }
+    // Add a body field to the comment type.
+    \Drupal::service('comment.manager')->addBodyField($comment_type_id);
+
+    // Add a comment field to the host entity type. Create the field storage if
+    // needed.
+    if (!array_key_exists($field_name, $entity_manager->getFieldStorageDefinitions($entity_type))) {
+      $entity_manager->getStorage('field_storage_config')->create(array(
+        'entity_type' => $entity_type,
+        'field_name' => $field_name,
+        'type' => 'comment',
+        'translatable' => TRUE,
+        'settings' => array(
+          'comment_type' => $comment_type_id,
+        ),
+      ))->save();
+    }
+    // Create the field if needed, and configure its form and view displays.
+    if (!array_key_exists($field_name, $entity_manager->getFieldDefinitions($entity_type, $bundle))) {
+      $entity_manager->getStorage('field_config')->create(array(
+        'label' => 'Comments',
+        'description' => '',
+        'field_name' => $field_name,
+        'entity_type' => $entity_type,
+        'bundle' => $bundle,
+        'required' => 1,
+        'default_value' => array(
+          array(
+            'status' => $default_value,
+            'cid' => 0,
+            'last_comment_name' => '',
+            'last_comment_timestamp' => 0,
+            'last_comment_uid' => 0,
+          ),
+        ),
+      ))->save();
+
+      // Entity form displays: assign widget settings for the 'default' form
+      // mode, and hide the field in all other form modes.
+      entity_get_form_display($entity_type, $bundle, 'default')
+        ->setComponent($field_name, array(
+          'type' => 'comment_default',
+          'weight' => 20,
+        ))
+        ->save();
+      foreach ($entity_manager->getFormModes($entity_type) as $id => $form_mode) {
+        $display = entity_get_form_display($entity_type, $bundle, $id);
+        // Only update existing displays.
+        if ($display && !$display->isNew()) {
+          $display->removeComponent($field_name)->save();
+        }
+      }
+
+      // Entity view displays: assign widget settings for the 'default' view
+      // mode, and hide the field in all other view modes.
+      entity_get_display($entity_type, $bundle, 'default')
+        ->setComponent($field_name, array(
+          'label' => 'above',
+          'type' => 'comment_default',
+          'weight' => 20,
+        ))
+        ->save();
+      foreach ($entity_manager->getViewModes($entity_type) as $id => $view_mode) {
+        $display = entity_get_display($entity_type, $bundle, $id);
+        // Only update existing displays.
+        if ($display && !$display->isNew()) {
+          $display->removeComponent($field_name)->save();
+        }
+      }
+    }
+  }
+
+}
diff --git a/core/modules/comment/src/Tests/CommentTranslationUITest.php b/core/modules/comment/src/Tests/CommentTranslationUITest.php
index 824c63b..0bed6e0 100644
--- a/core/modules/comment/src/Tests/CommentTranslationUITest.php
+++ b/core/modules/comment/src/Tests/CommentTranslationUITest.php
@@ -18,6 +18,8 @@
  */
 class CommentTranslationUITest extends ContentTranslationUITest {
 
+  use CommentTestTrait;
+
   /**
    * The subject of the test comment.
    */
@@ -53,12 +55,12 @@ function setupBundle() {
     parent::setupBundle();
     $this->drupalCreateContentType(array('type' => $this->nodeBundle, 'name' => $this->nodeBundle));
     // Add a comment field to the article content type.
-    $this->container->get('comment.manager')->addDefaultField('node', 'article', 'comment_article', CommentItemInterface::OPEN, 'comment_article');
+    $this->addDefaultCommentField('node', 'article', 'comment_article', CommentItemInterface::OPEN, 'comment_article');
     // Create a page content type.
     $this->drupalCreateContentType(array('type' => 'page', 'name' => 'page'));
     // Add a comment field to the page content type - this one won't be
     // translatable.
-    $this->container->get('comment.manager')->addDefaultField('node', 'page', 'comment');
+    $this->addDefaultCommentField('node', 'page', 'comment');
     // Mark this bundle as translatable.
     $this->container->get('content_translation.manager')->setEnabled('comment', 'comment_article', TRUE);
   }
diff --git a/core/modules/comment/src/Tests/CommentTypeTest.php b/core/modules/comment/src/Tests/CommentTypeTest.php
index 2a43eec..7e7df0f 100644
--- a/core/modules/comment/src/Tests/CommentTypeTest.php
+++ b/core/modules/comment/src/Tests/CommentTypeTest.php
@@ -127,7 +127,7 @@ public function testCommentTypeDeletion() {
     // Create a comment type programmatically.
     $type = $this->createCommentType('foo');
     $this->drupalCreateContentType(array('type' => 'page'));
-    \Drupal::service('comment.manager')->addDefaultField('node', 'page', 'foo', CommentItemInterface::OPEN, 'foo');
+    $this->addDefaultCommentField('node', 'page', 'foo', CommentItemInterface::OPEN, 'foo');
     $field_storage = FieldStorageConfig::loadByName('node', 'foo');
 
     $this->drupalLogin($this->adminUser);
@@ -176,7 +176,7 @@ public function testCommentTypeDeletion() {
 
     // Test exception thrown when re-using an existing comment type.
     try {
-      \Drupal::service('comment.manager')->addDefaultField('comment', 'comment', 'bar');
+      $this->addDefaultCommentField('comment', 'comment', 'bar');
       $this->fail('Exception not thrown.');
     }
     catch (\InvalidArgumentException $e) {
diff --git a/core/modules/comment/src/Tests/CommentUninstallTest.php b/core/modules/comment/src/Tests/CommentUninstallTest.php
index 419932d..1cca31a 100644
--- a/core/modules/comment/src/Tests/CommentUninstallTest.php
+++ b/core/modules/comment/src/Tests/CommentUninstallTest.php
@@ -17,6 +17,8 @@
  */
 class CommentUninstallTest extends WebTestBase {
 
+  use CommentTestTrait;
+
   /**
    * Modules to install.
    *
@@ -30,7 +32,7 @@ protected function setUp() {
     // Create an article content type.
     $this->drupalCreateContentType(array('type' => 'article', 'name' => t('Article')));
     // Create comment field on article so that adds 'comment_body' field.
-    $this->container->get('comment.manager')->addDefaultField('node', 'article');
+    $this->addDefaultCommentField('node', 'article');
   }
 
   /**
diff --git a/core/modules/comment/src/Tests/Views/CommentTestBase.php b/core/modules/comment/src/Tests/Views/CommentTestBase.php
index 7d4705f..202bf47 100644
--- a/core/modules/comment/src/Tests/Views/CommentTestBase.php
+++ b/core/modules/comment/src/Tests/Views/CommentTestBase.php
@@ -7,6 +7,7 @@
 
 namespace Drupal\comment\Tests\Views;
 
+use Drupal\comment\Tests\CommentTestTrait;
 use Drupal\views\Tests\ViewTestBase;
 use Drupal\views\Tests\ViewTestData;
 
@@ -15,6 +16,8 @@
  */
 abstract class CommentTestBase extends ViewTestBase {
 
+  use CommentTestTrait;
+
   /**
    * Modules to install.
    *
@@ -69,7 +72,7 @@ protected function setUp() {
     $this->drupalLogin($this->account);
 
     $this->drupalCreateContentType(array('type' => 'page', 'name' => t('Basic page')));
-    $this->container->get('comment.manager')->addDefaultField('node', 'page');
+    $this->addDefaultCommentField('node', 'page');
 
     $this->nodeUserPosted = $this->drupalCreateNode();
     $this->nodeUserCommented = $this->drupalCreateNode(array('uid' => $this->account2->id()));
diff --git a/core/modules/comment/src/Tests/Views/DefaultViewRecentCommentsTest.php b/core/modules/comment/src/Tests/Views/DefaultViewRecentCommentsTest.php
index acd1398..2b0f557 100644
--- a/core/modules/comment/src/Tests/Views/DefaultViewRecentCommentsTest.php
+++ b/core/modules/comment/src/Tests/Views/DefaultViewRecentCommentsTest.php
@@ -8,6 +8,7 @@
 namespace Drupal\comment\Tests\Views;
 
 use Drupal\comment\CommentInterface;
+use Drupal\comment\Tests\CommentTestTrait;
 use Drupal\views\Views;
 use Drupal\views\Tests\ViewTestBase;
 
@@ -18,6 +19,8 @@
  */
 class DefaultViewRecentCommentsTest extends ViewTestBase {
 
+  use CommentTestTrait;
+
   /**
    * Modules to install.
    *
@@ -71,7 +74,7 @@ protected function setUp() {
       'type' => $content_type->id(),
     );
 
-    $this->container->get('comment.manager')->addDefaultField('node', $content_type->id());
+    $this->addDefaultCommentField('node', $content_type->id());
     $this->node = $this->drupalCreateNode($node_data);
 
     // Force a flush of the in-memory storage.
diff --git a/core/modules/comment/src/Tests/Views/WizardTest.php b/core/modules/comment/src/Tests/Views/WizardTest.php
index 6747acc..3d9c730 100644
--- a/core/modules/comment/src/Tests/Views/WizardTest.php
+++ b/core/modules/comment/src/Tests/Views/WizardTest.php
@@ -7,6 +7,7 @@
 
 namespace Drupal\comment\Tests\Views;
 
+use Drupal\comment\Tests\CommentTestTrait;
 use Drupal\views\Views;
 use Drupal\views\Tests\Wizard\WizardTestBase;
 
@@ -18,6 +19,8 @@
  */
 class WizardTest extends WizardTestBase {
 
+  use CommentTestTrait;
+
   /**
    * Modules to install.
    *
@@ -33,7 +36,7 @@ protected function setUp() {
     parent::setUp();
     $this->drupalCreateContentType(array('type' => 'page', 'name' => t('Basic page')));
     // Add comment field to page node type.
-    $this->container->get('comment.manager')->addDefaultField('node', 'page');
+    $this->addDefaultCommentField('node', 'page');
   }
 
   /**
diff --git a/core/modules/content_translation/src/Tests/ContentTranslationSettingsTest.php b/core/modules/content_translation/src/Tests/ContentTranslationSettingsTest.php
index f5f3c89..b71f4dc 100644
--- a/core/modules/content_translation/src/Tests/ContentTranslationSettingsTest.php
+++ b/core/modules/content_translation/src/Tests/ContentTranslationSettingsTest.php
@@ -8,6 +8,7 @@
 namespace Drupal\content_translation\Tests;
 
 use Drupal\comment\Plugin\Field\FieldType\CommentItemInterface;
+use Drupal\comment\Tests\CommentTestTrait;
 use Drupal\Core\Field\Entity\BaseFieldOverride;
 use Drupal\Core\Language\Language;
 use Drupal\field\Entity\FieldConfig;
@@ -21,6 +22,8 @@
  */
 class ContentTranslationSettingsTest extends WebTestBase {
 
+  use CommentTestTrait;
+
   /**
    * Modules to enable.
    *
@@ -35,8 +38,8 @@ protected function setUp() {
     // bundles.
     $this->drupalCreateContentType(array('type' => 'article'));
     $this->drupalCreateContentType(array('type' => 'page'));
-    $this->container->get('comment.manager')->addDefaultField('node', 'article', 'comment_article', CommentItemInterface::OPEN, 'comment_article');
-    $this->container->get('comment.manager')->addDefaultField('node', 'page', 'comment_page');
+    $this->addDefaultCommentField('node', 'article', 'comment_article', CommentItemInterface::OPEN, 'comment_article');
+    $this->addDefaultCommentField('node', 'page', 'comment_page');
 
     $admin_user = $this->drupalCreateUser(array('access administration pages', 'administer languages', 'administer content translation', 'administer content types', 'administer node fields', 'administer comment fields', 'administer comments', 'administer comment types', 'administer account settings'));
     $this->drupalLogin($admin_user);
diff --git a/core/modules/file/src/Tests/FileFieldWidgetTest.php b/core/modules/file/src/Tests/FileFieldWidgetTest.php
index 4b52a5c..f3ae0c4 100644
--- a/core/modules/file/src/Tests/FileFieldWidgetTest.php
+++ b/core/modules/file/src/Tests/FileFieldWidgetTest.php
@@ -8,6 +8,7 @@
 namespace Drupal\file\Tests;
 
 use Drupal\comment\Entity\Comment;
+use Drupal\comment\Tests\CommentTestTrait;
 use Drupal\Component\Utility\Html;
 use Drupal\field\Entity\FieldConfig;
 use Drupal\field_ui\Tests\FieldUiTestTrait;
@@ -20,6 +21,7 @@
  */
 class FileFieldWidgetTest extends FileFieldTestBase {
 
+  use CommentTestTrait;
   use FieldUiTestTrait;
 
   /**
@@ -268,7 +270,7 @@ function testPrivateFileComment() {
     user_role_grant_permissions(DRUPAL_AUTHENTICATED_RID, array('post comments', 'skip comment approval'));
 
     // Create a new field.
-    $this->container->get('comment.manager')->addDefaultField('node', 'article');
+    $this->addDefaultCommentField('node', 'article');
 
     $name = strtolower($this->randomMachineName());
     $label = $this->randomMachineName();
diff --git a/core/modules/filter/src/Tests/FilterHtmlImageSecureTest.php b/core/modules/filter/src/Tests/FilterHtmlImageSecureTest.php
index 6febe30..df860f2 100644
--- a/core/modules/filter/src/Tests/FilterHtmlImageSecureTest.php
+++ b/core/modules/filter/src/Tests/FilterHtmlImageSecureTest.php
@@ -7,6 +7,7 @@
 
 namespace Drupal\filter\Tests;
 
+use Drupal\comment\Tests\CommentTestTrait;
 use Drupal\Core\StreamWrapper\PublicStream;
 use Drupal\simpletest\WebTestBase;
 
@@ -17,6 +18,8 @@
  */
 class FilterHtmlImageSecureTest extends WebTestBase {
 
+  use CommentTestTrait;
+
   /**
    * Modules to enable.
    *
@@ -68,7 +71,7 @@ protected function setUp() {
     // Setup a node to comment and test on.
     $this->drupalCreateContentType(array('type' => 'page', 'name' => 'Basic page'));
     // Add a comment field.
-    $this->container->get('comment.manager')->addDefaultField('node', 'page');
+    $this->addDefaultCommentField('node', 'page');
     $this->node = $this->drupalCreateNode();
   }
 
diff --git a/core/modules/hal/src/Tests/EntityTest.php b/core/modules/hal/src/Tests/EntityTest.php
index ef20228..a1b221d 100644
--- a/core/modules/hal/src/Tests/EntityTest.php
+++ b/core/modules/hal/src/Tests/EntityTest.php
@@ -7,6 +7,8 @@
 
 namespace Drupal\hal\Tests;
 
+use Drupal\comment\Tests\CommentTestTrait;
+
 /**
  * Tests that nodes and terms are correctly normalized and denormalized.
  *
@@ -14,6 +16,8 @@
  */
 class EntityTest extends NormalizerTestBase {
 
+  use CommentTestTrait;
+
   /**
    * Modules to enable.
    *
@@ -50,7 +54,7 @@ public function testNode() {
       'target_entity_type_id' => 'node',
     ))->save();
 
-    $this->container->get('comment.manager')->addDefaultField('node', 'example_type');
+    $this->addDefaultCommentField('node', 'example_type');
 
     $node = entity_create('node', array(
       'title' => $this->randomMachineName(),
@@ -146,7 +150,7 @@ public function testComment() {
       'target_entity_type_id' => 'node',
     ))->save();
 
-    $this->container->get('comment.manager')->addDefaultField('node', 'example_type');
+    $this->addDefaultCommentField('node', 'example_type');
 
     $node = entity_create('node', array(
       'title' => $this->randomMachineName(),
diff --git a/core/modules/migrate_drupal/src/Tests/d6/MigrateCommentTest.php b/core/modules/migrate_drupal/src/Tests/d6/MigrateCommentTest.php
index e44f31a..f327253 100644
--- a/core/modules/migrate_drupal/src/Tests/d6/MigrateCommentTest.php
+++ b/core/modules/migrate_drupal/src/Tests/d6/MigrateCommentTest.php
@@ -8,6 +8,7 @@
 namespace Drupal\migrate_drupal\Tests\d6;
 
 use Drupal\comment\Entity\Comment;
+use Drupal\comment\Tests\CommentTestTrait;
 use Drupal\Core\Language\LanguageInterface;
 use Drupal\migrate\MigrateExecutable;
 use Drupal\migrate_drupal\Tests\MigrateDrupalTestBase;
@@ -19,6 +20,8 @@
  */
 class MigrateCommentTest extends MigrateDrupalTestBase {
 
+  use CommentTestTrait;
+
   static $modules = array('node', 'comment');
 
   /**
@@ -28,7 +31,7 @@ protected function setUp() {
     parent::setUp();
     entity_create('node_type', array('type' => 'page'))->save();
     entity_create('node_type', array('type' => 'story'))->save();
-    \Drupal::service('comment.manager')->addDefaultField('node', 'story');
+    $this->addDefaultCommentField('node', 'story');
     $this->container->get('entity.manager')->getStorage('comment_type')->create(array(
       'id' => 'comment_no_subject',
       'label' => 'comment_no_subject',
diff --git a/core/modules/node/src/Tests/NodeAccessPagerTest.php b/core/modules/node/src/Tests/NodeAccessPagerTest.php
index f9deff8..6d1f90c 100644
--- a/core/modules/node/src/Tests/NodeAccessPagerTest.php
+++ b/core/modules/node/src/Tests/NodeAccessPagerTest.php
@@ -8,6 +8,7 @@
 namespace Drupal\node\Tests;
 
 use Drupal\comment\CommentInterface;
+use Drupal\comment\Tests\CommentTestTrait;
 use Drupal\simpletest\WebTestBase;
 
 /**
@@ -17,6 +18,8 @@
  */
 class NodeAccessPagerTest extends WebTestBase {
 
+  use CommentTestTrait;
+
   /**
    * Modules to enable.
    *
@@ -29,7 +32,7 @@ protected function setUp() {
 
     node_access_rebuild();
     $this->drupalCreateContentType(array('type' => 'page', 'name' => t('Basic page')));
-    $this->container->get('comment.manager')->addDefaultField('node', 'page');
+    $this->addDefaultCommentField('node', 'page');
     $this->webUser = $this->drupalCreateUser(array('access content', 'access comments', 'node test view'));
   }
 
diff --git a/core/modules/node/src/Tests/NodeTitleTest.php b/core/modules/node/src/Tests/NodeTitleTest.php
index 3e3be81..61dc3bf 100644
--- a/core/modules/node/src/Tests/NodeTitleTest.php
+++ b/core/modules/node/src/Tests/NodeTitleTest.php
@@ -7,6 +7,8 @@
 
 namespace Drupal\node\Tests;
 
+use Drupal\comment\Tests\CommentTestTrait;
+
 /**
  * Tests node title.
  *
@@ -14,6 +16,8 @@
  */
 class NodeTitleTest extends NodeTestBase {
 
+  use CommentTestTrait;
+
   /**
    * Modules to enable.
    *
@@ -37,7 +41,7 @@ protected function setUp() {
 
     $this->adminUser = $this->drupalCreateUser(array('administer nodes', 'create article content', 'create page content', 'post comments'));
     $this->drupalLogin($this->adminUser);
-    $this->container->get('comment.manager')->addDefaultField('node', 'page');
+    $this->addDefaultCommentField('node', 'page');
   }
 
   /**
diff --git a/core/modules/search/src/Tests/SearchCommentCountToggleTest.php b/core/modules/search/src/Tests/SearchCommentCountToggleTest.php
index 5f2fd43..92161d8 100644
--- a/core/modules/search/src/Tests/SearchCommentCountToggleTest.php
+++ b/core/modules/search/src/Tests/SearchCommentCountToggleTest.php
@@ -8,6 +8,7 @@
 namespace Drupal\search\Tests;
 
 use Drupal\comment\Plugin\Field\FieldType\CommentItemInterface;
+use Drupal\comment\Tests\CommentTestTrait;
 
 /**
  * Tests that comment count display toggles properly on comment status of node.
@@ -23,6 +24,8 @@
  */
 class SearchCommentCountToggleTest extends SearchTestBase {
 
+  use CommentTestTrait;
+
   /**
    * Modules to enable.
    *
@@ -54,7 +57,7 @@ protected function setUp() {
     $this->drupalLogin($this->searchingUser);
 
     // Add a comment field.
-    $this->container->get('comment.manager')->addDefaultField('node', 'article');
+    $this->addDefaultCommentField('node', 'article');
     // Create initial nodes.
     $node_params = array('type' => 'article', 'body' => array(array('value' => 'SearchCommentToggleTestCase')));
 
diff --git a/core/modules/search/src/Tests/SearchCommentTest.php b/core/modules/search/src/Tests/SearchCommentTest.php
index 1818350..c5921ea 100644
--- a/core/modules/search/src/Tests/SearchCommentTest.php
+++ b/core/modules/search/src/Tests/SearchCommentTest.php
@@ -8,6 +8,7 @@
 namespace Drupal\search\Tests;
 
 use Drupal\comment\Plugin\Field\FieldType\CommentItemInterface;
+use Drupal\comment\Tests\CommentTestTrait;
 use Drupal\Component\Utility\String;
 use Drupal\field\Entity\FieldConfig;
 
@@ -18,6 +19,8 @@
  */
 class SearchCommentTest extends SearchTestBase {
 
+  use CommentTestTrait;
+
   /**
    * Modules to enable.
    *
@@ -78,7 +81,7 @@ protected function setUp() {
     $this->adminUser = $this->drupalCreateUser($permissions);
     $this->drupalLogin($this->adminUser);
     // Add a comment field.
-    $this->container->get('comment.manager')->addDefaultField('node', 'article');
+    $this->addDefaultCommentField('node', 'article');
   }
 
   /**
diff --git a/core/modules/search/src/Tests/SearchRankingTest.php b/core/modules/search/src/Tests/SearchRankingTest.php
index f2fb125..8f855f5 100644
--- a/core/modules/search/src/Tests/SearchRankingTest.php
+++ b/core/modules/search/src/Tests/SearchRankingTest.php
@@ -8,6 +8,7 @@
 namespace Drupal\search\Tests;
 
 use Drupal\comment\Plugin\Field\FieldType\CommentItemInterface;
+use Drupal\comment\Tests\CommentTestTrait;
 use Drupal\Core\Url;
 
 /**
@@ -17,6 +18,8 @@
  */
 class SearchRankingTest extends SearchTestBase {
 
+  use CommentTestTrait;
+
   /**
    * The node search page.
    *
@@ -43,7 +46,7 @@ protected function setUp() {
 
   public function testRankings() {
     // Add a comment field.
-    $this->container->get('comment.manager')->addDefaultField('node', 'page');
+    $this->addDefaultCommentField('node', 'page');
 
     // Build a list of the rankings to test.
     $node_ranks = array('sticky', 'promote', 'relevance', 'recent', 'comments', 'views');
diff --git a/core/modules/system/src/Tests/Entity/EntityCrudHookTest.php b/core/modules/system/src/Tests/Entity/EntityCrudHookTest.php
index 35ea408..9386983 100644
--- a/core/modules/system/src/Tests/Entity/EntityCrudHookTest.php
+++ b/core/modules/system/src/Tests/Entity/EntityCrudHookTest.php
@@ -9,6 +9,7 @@
 
 use Drupal\comment\Entity\Comment;
 use Drupal\comment\Plugin\Field\FieldType\CommentItemInterface;
+use Drupal\comment\Tests\CommentTestTrait;
 use Drupal\Core\Database\Database;
 use Drupal\Core\Language\LanguageInterface;
 use Drupal\block\Entity\Block;
@@ -33,6 +34,8 @@
  */
 class EntityCrudHookTest extends EntityUnitTestBase {
 
+  use CommentTestTrait;
+
   /**
    * Modules to enable.
    *
@@ -140,7 +143,7 @@ public function testCommentHooks() {
       'type' => 'article',
       'name' => 'Article',
     ))->save();
-    $this->container->get('comment.manager')->addDefaultField('node', 'article', 'comment', CommentItemInterface::OPEN);
+    $this->addDefaultCommentField('node', 'article', 'comment', CommentItemInterface::OPEN);
 
     $node = entity_create('node', array(
       'uid' => $account->id(),
diff --git a/core/modules/system/src/Tests/Entity/EntityReferenceSelection/EntityReferenceSelectionAccessTest.php b/core/modules/system/src/Tests/Entity/EntityReferenceSelection/EntityReferenceSelectionAccessTest.php
index 5caeae3..c125653 100644
--- a/core/modules/system/src/Tests/Entity/EntityReferenceSelection/EntityReferenceSelectionAccessTest.php
+++ b/core/modules/system/src/Tests/Entity/EntityReferenceSelection/EntityReferenceSelectionAccessTest.php
@@ -7,6 +7,7 @@
 
 namespace Drupal\system\Tests\Entity\EntityReferenceSelection;
 
+use Drupal\comment\Tests\CommentTestTrait;
 use Drupal\Component\Utility\String;
 use Drupal\Core\Language\LanguageInterface;
 use Drupal\comment\CommentInterface;
@@ -19,6 +20,8 @@
  */
 class EntityReferenceSelectionAccessTest extends WebTestBase {
 
+  use CommentTestTrait;
+
   /**
    * Modules to enable.
    *
@@ -354,7 +357,7 @@ public function testCommentHandler() {
     }
 
     // Create comment field on article.
-    $this->container->get('comment.manager')->addDefaultField('node', 'article');
+    $this->addDefaultCommentField('node', 'article');
 
     $comment_values = array(
       'published_published' => array(
diff --git a/core/modules/system/src/Tests/Theme/EntityFilteringThemeTest.php b/core/modules/system/src/Tests/Theme/EntityFilteringThemeTest.php
index 8360cd4..10b52e5 100644
--- a/core/modules/system/src/Tests/Theme/EntityFilteringThemeTest.php
+++ b/core/modules/system/src/Tests/Theme/EntityFilteringThemeTest.php
@@ -7,6 +7,7 @@
 
 namespace Drupal\system\Tests\Theme;
 
+use Drupal\comment\Tests\CommentTestTrait;
 use Drupal\Core\Extension\ExtensionDiscovery;
 use Drupal\comment\CommentInterface;
 use Drupal\comment\Plugin\Field\FieldType\CommentItemInterface;
@@ -20,6 +21,8 @@
  */
 class EntityFilteringThemeTest extends WebTestBase {
 
+  use CommentTestTrait;
+
   /**
    * Use the standard profile.
    *
@@ -97,7 +100,7 @@ protected function setUp() {
     $this->term->save();
 
     // Add a comment field.
-    $this->container->get('comment.manager')->addDefaultField('node', 'article', 'comment', CommentItemInterface::OPEN);
+    $this->addDefaultCommentField('node', 'article', 'comment', CommentItemInterface::OPEN);
     // Create a test node tagged with the test term.
     $this->node = $this->drupalCreateNode(array(
       'title' => $this->xss_label,
diff --git a/core/modules/tracker/src/Tests/TrackerNodeAccessTest.php b/core/modules/tracker/src/Tests/TrackerNodeAccessTest.php
index 62129d8..762a38f 100644
--- a/core/modules/tracker/src/Tests/TrackerNodeAccessTest.php
+++ b/core/modules/tracker/src/Tests/TrackerNodeAccessTest.php
@@ -8,6 +8,7 @@
 namespace Drupal\tracker\Tests;
 
 use Drupal\comment\Plugin\Field\FieldType\CommentItemInterface;
+use Drupal\comment\Tests\CommentTestTrait;
 use Drupal\simpletest\WebTestBase;
 
 /**
@@ -17,6 +18,8 @@
  */
 class TrackerNodeAccessTest extends WebTestBase {
 
+  use CommentTestTrait;
+
   /**
    * Modules to enable.
    *
@@ -29,7 +32,7 @@ protected function setUp() {
     node_access_rebuild();
     $this->drupalCreateContentType(array('type' => 'page'));
     node_access_test_add_field(entity_load('node_type', 'page'));
-    $this->container->get('comment.manager')->addDefaultField('node', 'page', 'comment', CommentItemInterface::OPEN);
+    $this->addDefaultCommentField('node', 'page', 'comment', CommentItemInterface::OPEN);
     \Drupal::state()->set('node_access_test.private', TRUE);
   }
 
diff --git a/core/modules/tracker/src/Tests/TrackerTest.php b/core/modules/tracker/src/Tests/TrackerTest.php
index 80f6fa5..3ca1dc4 100644
--- a/core/modules/tracker/src/Tests/TrackerTest.php
+++ b/core/modules/tracker/src/Tests/TrackerTest.php
@@ -8,6 +8,7 @@
 namespace Drupal\tracker\Tests;
 
 use Drupal\comment\CommentInterface;
+use Drupal\comment\Tests\CommentTestTrait;
 use Drupal\simpletest\WebTestBase;
 
 /**
@@ -17,6 +18,8 @@
  */
 class TrackerTest extends WebTestBase {
 
+  use CommentTestTrait;
+
   /**
    * Modules to enable.
    *
@@ -46,7 +49,7 @@ protected function setUp() {
     $permissions = array('access comments', 'create page content', 'post comments', 'skip comment approval');
     $this->user = $this->drupalCreateUser($permissions);
     $this->otherUser = $this->drupalCreateUser($permissions);
-    $this->container->get('comment.manager')->addDefaultField('node', 'page');
+    $this->addDefaultCommentField('node', 'page');
   }
 
   /**
diff --git a/core/modules/tracker/src/Tests/Views/TrackerTestBase.php b/core/modules/tracker/src/Tests/Views/TrackerTestBase.php
index 5ec6597..a8b36e8 100644
--- a/core/modules/tracker/src/Tests/Views/TrackerTestBase.php
+++ b/core/modules/tracker/src/Tests/Views/TrackerTestBase.php
@@ -7,6 +7,7 @@
 
 namespace Drupal\tracker\Tests\Views;
 
+use Drupal\comment\Tests\CommentTestTrait;
 use Drupal\Core\Language\LanguageInterface;
 use Drupal\views\Tests\ViewTestBase;
 use Drupal\views\Tests\ViewTestData;
@@ -16,6 +17,8 @@
  */
 abstract class TrackerTestBase extends ViewTestBase {
 
+  use CommentTestTrait;
+
   /**
    * Modules to enable.
    *
@@ -44,7 +47,7 @@ protected function setUp() {
 
     $this->drupalCreateContentType(array('type' => 'page', 'name' => 'Basic page'));
     // Add a comment field.
-    $this->container->get('comment.manager')->addDefaultField('node', 'page');
+    $this->addDefaultCommentField('node', 'page');
 
     $permissions = array('access comments', 'create page content', 'post comments', 'skip comment approval');
     $account = $this->drupalCreateUser($permissions);
diff --git a/core/modules/user/src/Tests/UserCancelTest.php b/core/modules/user/src/Tests/UserCancelTest.php
index c40f63b..029a66c 100644
--- a/core/modules/user/src/Tests/UserCancelTest.php
+++ b/core/modules/user/src/Tests/UserCancelTest.php
@@ -7,6 +7,7 @@
 
 namespace Drupal\user\Tests;
 
+use Drupal\comment\Tests\CommentTestTrait;
 use Drupal\simpletest\WebTestBase;
 use Drupal\comment\CommentInterface;
 use Drupal\comment\Entity\Comment;
@@ -18,6 +19,8 @@
  */
 class UserCancelTest extends WebTestBase {
 
+  use CommentTestTrait;
+
   /**
    * Modules to enable.
    *
@@ -210,7 +213,7 @@ function testUserBlockUnpublish() {
     $node_storage = $this->container->get('entity.manager')->getStorage('node');
     $this->config('user.settings')->set('cancel_method', 'user_cancel_block_unpublish')->save();
     // Create comment field on page.
-    \Drupal::service('comment.manager')->addDefaultField('node', 'page');
+    $this->addDefaultCommentField('node', 'page');
 
     // Create a user.
     $account = $this->drupalCreateUser(array('cancel account'));
@@ -332,7 +335,7 @@ function testUserDelete() {
     $this->config('user.settings')->set('cancel_method', 'user_cancel_delete')->save();
     \Drupal::service('module_installer')->install(array('comment'));
     $this->resetAll();
-    $this->container->get('comment.manager')->addDefaultField('node', 'page');
+    $this->addDefaultCommentField('node', 'page');
 
     // Create a user.
     $account = $this->drupalCreateUser(array('cancel account', 'post comments', 'skip comment approval'));
diff --git a/core/modules/user/src/Tests/UserSignatureTest.php b/core/modules/user/src/Tests/UserSignatureTest.php
index dcccbdf..4e6911a 100644
--- a/core/modules/user/src/Tests/UserSignatureTest.php
+++ b/core/modules/user/src/Tests/UserSignatureTest.php
@@ -7,6 +7,7 @@
 
 namespace Drupal\user\Tests;
 
+use Drupal\comment\Tests\CommentTestTrait;
 use Drupal\simpletest\WebTestBase;
 
 /**
@@ -16,6 +17,8 @@
  */
 class UserSignatureTest extends WebTestBase {
 
+  use CommentTestTrait;
+
   /**
    * A regular user.
    *
@@ -60,7 +63,7 @@ protected function setUp() {
     // Create Basic page node type.
     $this->drupalCreateContentType(array('type' => 'page', 'name' => 'Basic page'));
     // Add a comment field with commenting enabled by default.
-    $this->container->get('comment.manager')->addDefaultField('node', 'page');
+    $this->addDefaultCommentField('node', 'page');
 
     // Prefetch and create text formats.
     $this->filteredHtmlFormat = entity_create('filter_format', array(
diff --git a/core/modules/views/src/Tests/DefaultViewsTest.php b/core/modules/views/src/Tests/DefaultViewsTest.php
index 43aae1f..03f389e 100644
--- a/core/modules/views/src/Tests/DefaultViewsTest.php
+++ b/core/modules/views/src/Tests/DefaultViewsTest.php
@@ -8,6 +8,7 @@
 namespace Drupal\views\Tests;
 
 use Drupal\comment\CommentInterface;
+use Drupal\comment\Tests\CommentTestTrait;
 use Drupal\Component\Utility\Unicode;
 use Drupal\Core\Language\LanguageInterface;
 use Drupal\Core\Url;
@@ -22,6 +23,8 @@
  */
 class DefaultViewsTest extends ViewTestBase {
 
+  use CommentTestTrait;
+
   /**
    * Modules to enable.
    *
@@ -81,7 +84,7 @@ protected function setUp() {
     // Create a time in the past for the archive.
     $time = REQUEST_TIME - 3600;
 
-    $this->container->get('comment.manager')->addDefaultField('node', 'page');
+    $this->addDefaultCommentField('node', 'page');
 
     $this->container->get('views.views_data')->clear();
 
diff --git a/core/modules/views/src/Tests/Entity/FieldEntityTest.php b/core/modules/views/src/Tests/Entity/FieldEntityTest.php
index d01ba1d..acc7680 100644
--- a/core/modules/views/src/Tests/Entity/FieldEntityTest.php
+++ b/core/modules/views/src/Tests/Entity/FieldEntityTest.php
@@ -7,6 +7,7 @@
 
 namespace Drupal\views\Tests\Entity;
 
+use Drupal\comment\Tests\CommentTestTrait;
 use Drupal\views\Tests\ViewTestBase;
 use Drupal\views\Views;
 
@@ -17,6 +18,8 @@
  */
 class FieldEntityTest extends ViewTestBase {
 
+  use CommentTestTrait;
+
   /**
    * Views used by this test.
    *
@@ -41,7 +44,7 @@ public function testGetEntity() {
     $account = entity_create('user', array('name' => $this->randomMachineName(), 'bundle' => 'user'));
     $account->save();
     $this->drupalCreateContentType(array('type' => 'page'));
-    $this->container->get('comment.manager')->addDefaultField('node', 'page');
+    $this->addDefaultCommentField('node', 'page');
     // Force a flush of the in-memory storage.
     $this->container->get('views.views_data')->clear();
 
diff --git a/core/modules/views/src/Tests/Handler/HandlerAllTest.php b/core/modules/views/src/Tests/Handler/HandlerAllTest.php
index ba83c54..7306c13 100644
--- a/core/modules/views/src/Tests/Handler/HandlerAllTest.php
+++ b/core/modules/views/src/Tests/Handler/HandlerAllTest.php
@@ -7,6 +7,7 @@
 
 namespace Drupal\views\Tests\Handler;
 
+use Drupal\comment\Tests\CommentTestTrait;
 use Drupal\views\ViewExecutable;
 use Drupal\views\Plugin\views\HandlerBase;
 use Drupal\views\Plugin\views\filter\InOperator;
@@ -18,6 +19,8 @@
  */
 class HandlerAllTest extends HandlerTestBase {
 
+  use CommentTestTrait;
+
   /**
    * Modules to enable.
    *
@@ -48,7 +51,7 @@ class HandlerAllTest extends HandlerTestBase {
    */
   public function testHandlers() {
     $this->drupalCreateContentType(array('type' => 'article'));
-    $this->container->get('comment.manager')->addDefaultField('node', 'article');
+    $this->addDefaultCommentField('node', 'article');
 
     $object_types = array_keys(ViewExecutable::getHandlerTypes());
     foreach ($this->container->get('views.views_data')->get() as $base_table => $info) {
diff --git a/core/modules/views/src/Tests/Handler/HandlerTest.php b/core/modules/views/src/Tests/Handler/HandlerTest.php
index f08acc2..1abb773 100644
--- a/core/modules/views/src/Tests/Handler/HandlerTest.php
+++ b/core/modules/views/src/Tests/Handler/HandlerTest.php
@@ -7,6 +7,7 @@
 
 namespace Drupal\views\Tests\Handler;
 
+use Drupal\comment\Tests\CommentTestTrait;
 use Drupal\views\Entity\View;
 use Drupal\views\ViewExecutable;
 use Drupal\views\Tests\ViewTestBase;
@@ -20,6 +21,8 @@
  */
 class HandlerTest extends ViewTestBase {
 
+  use CommentTestTrait;
+
   /**
    * Views used by this test.
    *
@@ -37,7 +40,7 @@ class HandlerTest extends ViewTestBase {
   protected function setUp() {
     parent::setUp();
     $this->drupalCreateContentType(array('type' => 'page'));
-    $this->container->get('comment.manager')->addDefaultField('node', 'page');
+    $this->addDefaultCommentField('node', 'page');
     $this->enableViewsTestModule();
   }
 
diff --git a/core/modules/views/src/Tests/ViewExecutableTest.php b/core/modules/views/src/Tests/ViewExecutableTest.php
index 4e69ba3..e99ca1d 100644
--- a/core/modules/views/src/Tests/ViewExecutableTest.php
+++ b/core/modules/views/src/Tests/ViewExecutableTest.php
@@ -7,6 +7,7 @@
 
 namespace Drupal\views\Tests;
 
+use Drupal\comment\Tests\CommentTestTrait;
 use Drupal\views\Views;
 use Drupal\views\ViewExecutable;
 use Drupal\views\ViewExecutableFactory;
@@ -30,6 +31,8 @@
  */
 class ViewExecutableTest extends ViewUnitTestBase {
 
+  use CommentTestTrait;
+
   public static $modules = array('system', 'node', 'comment', 'user', 'filter', 'field', 'text', 'entity_reference');
 
   /**
@@ -86,7 +89,7 @@ protected function setUpFixtures() {
       'type' => 'page',
       'name' => 'Page',
     ))->save();
-    $this->container->get('comment.manager')->addDefaultField('node', 'page');
+    $this->addDefaultCommentField('node', 'page');
     parent::setUpFixtures();
 
     $this->installConfig(array('filter'));
