diff --git a/core/modules/views/src/Tests/ViewResultAssertionTrait.php b/core/modules/views/src/Tests/ViewResultAssertionTrait.php
new file mode 100644
index 0000000..41692e8
--- /dev/null
+++ b/core/modules/views/src/Tests/ViewResultAssertionTrait.php
@@ -0,0 +1,131 @@
+<?php
+
+/**
+ * @file
+ * contains Drupal\views\Tests\ViewResultAssertionTrait.
+ */
+
+namespace Drupal\views\Tests;
+
+use Drupal\views\ViewExecutable;
+
+/**
+ * Provides a class for assertions to check for the expected result of a View.
+ */
+trait ViewResultAssertionTrait {
+
+  /**
+   * Verifies that a result set returned by a View matches expected values.
+   *
+   * The comparison is done on the string representation of the columns of the
+   * column map, taking the order of the rows into account, but not the order
+   * of the columns.
+   *
+   * @param \Drupal\views\ViewExecutable $view
+   *   An executed View.
+   * @param array $expected_result
+   *   An expected result set.
+   * @param array $column_map
+   *   (optional) An associative array mapping the columns of the result set
+   *   from the view (as keys) and the expected result set (as values).
+   * @param string $message
+   *   (optional) A custom message to display with the assertion. Defaults to
+   *   'Identical result set.'
+   *
+   * @return bool
+   *   TRUE if the assertion succeeded, or FALSE otherwise.
+   */
+  protected function assertIdenticalResultset($view, $expected_result, $column_map = array(), $message = NULL) {
+    return $this->assertIdenticalResultsetHelper($view, $expected_result, $column_map, 'assertIdentical', $message);
+  }
+
+  /**
+   * Verifies that a result set returned by a View differs from certain values.
+   *
+   * Inverse of ViewsTestCase::assertIdenticalResultset().
+   *
+   * @param \Drupal\views\ViewExecutable $view
+   *   An executed View.
+   * @param array $expected_result
+   *   An expected result set.
+   * @param array $column_map
+   *   (optional) An associative array mapping the columns of the result set
+   *  from the view (as keys) and the expected result set (as values).
+   * @param string $message
+   *   (optional) A custom message to display with the assertion. Defaults to
+   *   'Non-identical result set.'
+   *
+   * @return bool
+   *   TRUE if the assertion succeeded, or FALSE otherwise.
+   */
+  protected function assertNotIdenticalResultset($view, $expected_result, $column_map = array(), $message = NULL) {
+    return $this->assertIdenticalResultsetHelper($view, $expected_result, $column_map, 'assertNotIdentical', $message);
+  }
+
+  /**
+   * Performs View result assertions.
+   *
+   * This is a helper method for ViewTestBase::assertIdenticalResultset() and
+   * ViewTestBase::assertNotIdenticalResultset().
+   *
+   * @param \Drupal\views\ViewExecutable $view
+   *   An executed View.
+   * @param array $expected_result
+   *   An expected result set.
+   * @param array $column_map
+   *   An associative array mapping the columns of the result set
+   *   from the view (as keys) and the expected result set (as values).
+   * @param string $assert_method
+   *   The TestBase assertion method to use (either 'assertIdentical' or
+   *   'assertNotIdentical').
+   * @param string $message
+   *   (optional) The message to display with the assertion.
+   *
+   * @return bool
+   *   TRUE if the assertion succeeded, or FALSE otherwise.
+   */
+  protected function assertIdenticalResultsetHelper($view, $expected_result, $column_map, $assert_method, $message = NULL) {
+    // Convert $view->result to an array of arrays.
+    $result = array();
+    foreach ($view->result as $key => $value) {
+      $row = array();
+      foreach ($column_map as $view_column => $expected_column) {
+        // The comparison will be done on the string representation of the value.
+        $row[$expected_column] = (string) $value->$view_column;
+      }
+      $result[$key] = $row;
+    }
+
+    // Remove the columns we don't need from the expected result.
+    foreach ($expected_result as $key => $value) {
+      $row = array();
+      foreach ($column_map as $expected_column) {
+        // The comparison will be done on the string representation of the value.
+        $row[$expected_column] = (string) (is_object($value) ? $value->$expected_column : $value[$expected_column]);
+      }
+      $expected_result[$key] = $row;
+    }
+
+    $this->verbose('<pre style="white-space: pre-wrap;">'
+      . "\n\nQuery:\n" . $view->build_info['query']
+      . "\n\nQuery arguments:\n" . var_export($view->build_info['query_args'], TRUE)
+      . "\n\nActual result:\n" . var_export($result, TRUE)
+      . "\n\nExpected result:\n" . var_export($expected_result, TRUE));
+
+    // Reset the numbering of the arrays.
+    $result = array_values($result);
+    $expected_result = array_values($expected_result);
+
+    // Do the actual comparison.
+    if (!isset($message)) {
+      $not = (strpos($assert_method, 'Not') ? 'not' : '');
+      $message = format_string("Actual result <pre>\n@actual\n</pre> is $not identical to expected <pre>\n@expected\n</pre>", array(
+        '@actual' => var_export($result, TRUE),
+        '@expected' => var_export($expected_result, TRUE),
+      ));
+    }
+    return $this->$assert_method($result, $expected_result, $message);
+  }
+
+}
+
diff --git a/core/modules/views/src/Tests/ViewTestBase.php b/core/modules/views/src/Tests/ViewTestBase.php
index c33776d..042c5ce 100644
--- a/core/modules/views/src/Tests/ViewTestBase.php
+++ b/core/modules/views/src/Tests/ViewTestBase.php
@@ -23,6 +23,8 @@
  */
 abstract class ViewTestBase extends WebTestBase {
 
+  use ViewResultAssertionTrait;
+
   /**
    * Modules to enable.
    *
@@ -69,111 +71,6 @@ protected function enableViewsTestModule() {
   }
 
   /**
-   * Verifies that a result set returned by a View matches expected values.
-   *
-   * The comparison is done on the string representation of the columns of the
-   * column map, taking the order of the rows into account, but not the order
-   * of the columns.
-   *
-   * @param \Drupal\views\ViewExecutable $view
-   *   An executed View.
-   * @param array $expected_result
-   *   An expected result set.
-   * @param array $column_map
-   *   (optional) An associative array mapping the columns of the result set
-   *   from the view (as keys) and the expected result set (as values).
-   * @param string $message
-   *   (optional) A custom message to display with the assertion. Defaults to
-   *   'Identical result set.'
-   *
-   * @return bool
-   *   TRUE if the assertion succeeded, or FALSE otherwise.
-   */
-  protected function assertIdenticalResultset(ViewExecutable $view, $expected_result, $column_map = array(), $message = 'Identical result set.') {
-    return $this->assertIdenticalResultsetHelper($view, $expected_result, $column_map, $message, 'assertIdentical');
-  }
-
-  /**
-   * Verifies that a result set returned by a View differs from certain values.
-   *
-   * Inverse of ViewsTestCase::assertIdenticalResultset().
-   *
-   * @param \Drupal\views\ViewExecutable $view
-   *   An executed View.
-   * @param array $expected_result
-   *   An expected result set.
-   * @param array $column_map
-   *   (optional) An associative array mapping the columns of the result set
-   *  from the view (as keys) and the expected result set (as values).
-   * @param string $message
-   *   (optional) A custom message to display with the assertion. Defaults to
-   *   'Non-identical result set.'
-   *
-   * @return bool
-   *   TRUE if the assertion succeeded, or FALSE otherwise.
-   */
-  protected function assertNotIdenticalResultset(ViewExecutable $view, $expected_result, $column_map = array(), $message = 'Non-identical result set.') {
-    return $this->assertIdenticalResultsetHelper($view, $expected_result, $column_map, $message, 'assertNotIdentical');
-  }
-
-  /**
-   * Performs View result assertions.
-   *
-   * This is a helper method for ViewTestBase::assertIdenticalResultset() and
-   * ViewTestBase::assertNotIdenticalResultset().
-   *
-   * @param \Drupal\views\ViewExecutable $view
-   *   An executed View.
-   * @param array $expected_result
-   *   An expected result set.
-   * @param array $column_map
-   *   An associative array mapping the columns of the result set
-   *   from the view (as keys) and the expected result set (as values).
-   * @param string $message
-   *   The message to display with the assertion.
-   * @param string $assert_method
-   *   The TestBase assertion method to use (either 'assertIdentical' or
-   *   'assertNotIdentical').
-   *
-   * @return bool
-   *   TRUE if the assertion succeeded, or FALSE otherwise.
-   *
-   * @see \Drupal\views\Tests\ViewTestBase::assertIdenticalResultset()
-   * @see \Drupal\views\Tests\ViewTestBase::assertNotIdenticalResultset()
-   */
-  protected function assertIdenticalResultsetHelper(ViewExecutable $view, $expected_result, $column_map, $message, $assert_method) {
-    // Convert $view->result to an array of arrays.
-    $result = array();
-    foreach ($view->result as $key => $value) {
-      $row = array();
-      foreach ($column_map as $view_column => $expected_column) {
-        // The comparison will be done on the string representation of the value.
-        $row[$expected_column] = (string) $value->$view_column;
-      }
-      $result[$key] = $row;
-    }
-
-    // Remove the columns we don't need from the expected result.
-    foreach ($expected_result as $key => $value) {
-      $row = array();
-      foreach ($column_map as $expected_column) {
-        // The comparison will be done on the string representation of the value.
-        $row[$expected_column] = (string) (is_object($value) ? $value->$expected_column : $value[$expected_column]);
-      }
-      $expected_result[$key] = $row;
-    }
-
-    // Reset the numbering of the arrays.
-    $result = array_values($result);
-    $expected_result = array_values($expected_result);
-
-    $this->verbose('<pre>Returned data set: ' . print_r($result, TRUE) . "\n\nExpected: ". print_r($expected_result, TRUE));
-
-    // Do the actual comparison.
-    return $this->$assert_method($result, $expected_result, $message);
-  }
-
-  /**
    * Orders a nested array containing a result set based on a given column.
    *
    * @param array $result_set
diff --git a/core/modules/views/src/Tests/ViewUnitTestBase.php b/core/modules/views/src/Tests/ViewUnitTestBase.php
index 86ed262..16b1e38 100644
--- a/core/modules/views/src/Tests/ViewUnitTestBase.php
+++ b/core/modules/views/src/Tests/ViewUnitTestBase.php
@@ -24,6 +24,8 @@
  */
 abstract class ViewUnitTestBase extends KernelTestBase {
 
+  use ViewResultAssertionTrait;
+
   /**
    * Modules to enable.
    *
@@ -74,122 +76,6 @@ protected function setUpFixtures() {
   }
 
   /**
-   * Verifies that a result set returned by a View matches expected values.
-   *
-   * The comparison is done on the string representation of the columns of the
-   * column map, taking the order of the rows into account, but not the order
-   * of the columns.
-   *
-   * @param \Drupal\views\ViewExecutable $view
-   *   An executed View.
-   * @param array $expected_result
-   *   An expected result set.
-   * @param array $column_map
-   *   (optional) An associative array mapping the columns of the result set
-   *   from the view (as keys) and the expected result set (as values).
-   * @param string $message
-   *   (optional) A custom message to display with the assertion. Defaults to
-   *   'Identical result set.'
-   *
-   * @return bool
-   *   TRUE if the assertion succeeded, or FALSE otherwise.
-   */
-  protected function assertIdenticalResultset($view, $expected_result, $column_map = array(), $message = NULL) {
-    return $this->assertIdenticalResultsetHelper($view, $expected_result, $column_map, 'assertIdentical', $message);
-  }
-
-  /**
-   * Verifies that a result set returned by a View differs from certain values.
-   *
-   * Inverse of ViewsTestCase::assertIdenticalResultset().
-   *
-   * @param \Drupal\views\ViewExecutable $view
-   *   An executed View.
-   * @param array $expected_result
-   *   An expected result set.
-   * @param array $column_map
-   *   (optional) An associative array mapping the columns of the result set
-   *  from the view (as keys) and the expected result set (as values).
-   * @param string $message
-   *   (optional) A custom message to display with the assertion. Defaults to
-   *   'Non-identical result set.'
-   *
-   * @return bool
-   *   TRUE if the assertion succeeded, or FALSE otherwise.
-   */
-  protected function assertNotIdenticalResultset($view, $expected_result, $column_map = array(), $message = NULL) {
-    return $this->assertIdenticalResultsetHelper($view, $expected_result, $column_map, 'assertNotIdentical', $message);
-  }
-
-  /**
-   * Performs View result assertions.
-   *
-   * This is a helper method for ViewTestBase::assertIdenticalResultset() and
-   * ViewTestBase::assertNotIdenticalResultset().
-   *
-   * @param \Drupal\views\ViewExecutable $view
-   *   An executed View.
-   * @param array $expected_result
-   *   An expected result set.
-   * @param array $column_map
-   *   An associative array mapping the columns of the result set
-   *   from the view (as keys) and the expected result set (as values).
-   * @param string $assert_method
-   *   The TestBase assertion method to use (either 'assertIdentical' or
-   *   'assertNotIdentical').
-   * @param string $message
-   *   (optional) The message to display with the assertion.
-   *
-   * @return bool
-   *   TRUE if the assertion succeeded, or FALSE otherwise.
-   *
-   * @see \Drupal\views\Tests\ViewTestBase::assertIdenticalResultset()
-   * @see \Drupal\views\Tests\ViewTestBase::assertNotIdenticalResultset()
-   */
-  protected function assertIdenticalResultsetHelper($view, $expected_result, $column_map, $assert_method, $message = NULL) {
-    // Convert $view->result to an array of arrays.
-    $result = array();
-    foreach ($view->result as $key => $value) {
-      $row = array();
-      foreach ($column_map as $view_column => $expected_column) {
-        // The comparison will be done on the string representation of the value.
-        $row[$expected_column] = (string) $value->$view_column;
-      }
-      $result[$key] = $row;
-    }
-
-    // Remove the columns we don't need from the expected result.
-    foreach ($expected_result as $key => $value) {
-      $row = array();
-      foreach ($column_map as $expected_column) {
-        // The comparison will be done on the string representation of the value.
-        $row[$expected_column] = (string) (is_object($value) ? $value->$expected_column : $value[$expected_column]);
-      }
-      $expected_result[$key] = $row;
-    }
-
-    $this->verbose('<pre style="white-space: pre-wrap;">'
-      . "\n\nQuery:\n" . $view->build_info['query']
-      . "\n\nQuery arguments:\n" . var_export($view->build_info['query_args'], TRUE)
-      . "\n\nActual result:\n" . var_export($result, TRUE)
-      . "\n\nExpected result:\n" . var_export($expected_result, TRUE));
-
-    // Reset the numbering of the arrays.
-    $result = array_values($result);
-    $expected_result = array_values($expected_result);
-
-    // Do the actual comparison.
-    if (!isset($message)) {
-      $not = (strpos($assert_method, 'Not') ? 'not' : '');
-      $message = format_string("Actual result <pre>\n@actual\n</pre> is $not identical to expected <pre>\n@expected\n</pre>", array(
-        '@actual' => var_export($result, TRUE),
-        '@expected' => var_export($expected_result, TRUE),
-      ));
-    }
-    return $this->$assert_method($result, $expected_result, $message);
-  }
-
-  /**
    * Orders a nested array containing a result set based on a given column.
    *
    * @param array $result_set
