diff --git a/core/modules/views/src/Tests/ViewResultAssertionTrait.php b/core/modules/views/src/Tests/ViewResultAssertionTrait.php
index 00501f5..f0387ea 100644
--- a/core/modules/views/src/Tests/ViewResultAssertionTrait.php
+++ b/core/modules/views/src/Tests/ViewResultAssertionTrait.php
@@ -88,7 +88,6 @@ protected function assertIdenticalResultsetHelper($view, $expected_result, $colu
         if (property_exists($value, $view_column)) {
           $row[$expected_column] = (string) $value->$view_column;
         }
-        // The comparison will be done on the string representation of the value.
         // For entity fields we don't have the raw value. Let's try to fetch it
         // using the entity itself.
         elseif (empty($value->$view_column) && isset($view->field[$expected_column]) && ($field = $view->field[$expected_column]) && $field instanceof EntityField) {
@@ -96,7 +95,10 @@ protected function assertIdenticalResultsetHelper($view, $expected_result, $colu
           if (count(explode(':', $view_column)) == 2) {
             $column = explode(':', $view_column)[1];
           }
-          $row[$expected_column] = $field->getValue($value, $column);
+          // The comparison will be done on the string representation of the
+          // value.
+          $field_value = $field->getValue($value, $column);
+          $row[$expected_column] = is_array($field_value) ? array_map('strval', $field_value) : (string) $field_value;
         }
       }
       $result[$key] = $row;
diff --git a/core/modules/views/tests/modules/views_entity_test/views_entity_test.module b/core/modules/views/tests/modules/views_entity_test/views_entity_test.module
index 6ed0772..7d80e84 100644
--- a/core/modules/views/tests/modules/views_entity_test/views_entity_test.module
+++ b/core/modules/views/tests/modules/views_entity_test/views_entity_test.module
@@ -45,3 +45,20 @@ function views_entity_test_entity_field_access($operation, FieldDefinitionInterf
   // No opinion.
   return AccessResult::neutral();
 }
+
+/**
+ * Implements hook_entity_load().
+ *
+ * @see \Drupal\Tests\views\Kernel\Handler\FieldFieldTest::testSimpleExecute()
+ */
+function views_entity_test_entity_load(array $entities, $entity_type_id) {
+  if ($entity_type_id === 'entity_test') {
+    // Cast the value of an entity field to be something else than a string so
+    // we can check that
+    // \Drupal\views\Tests\ViewResultAssertionTrait::assertIdenticalResultsetHelper()
+    // takes care of converting all field values to strings.
+    foreach ($entities as $entity) {
+      $entity->user_id->target_id = (int) $entity->user_id->target_id;
+    }
+  }
+}
diff --git a/core/modules/views/tests/src/Kernel/Handler/FieldFieldTest.php b/core/modules/views/tests/src/Kernel/Handler/FieldFieldTest.php
index 1d304f5..8bdab81 100644
--- a/core/modules/views/tests/src/Kernel/Handler/FieldFieldTest.php
+++ b/core/modules/views/tests/src/Kernel/Handler/FieldFieldTest.php
@@ -24,7 +24,7 @@ class FieldFieldTest extends ViewsKernelTestBase {
   /**
    * {@inheritdoc}
    */
-  public static $modules = ['field', 'entity_test', 'user', 'views_test_formatter'];
+  public static $modules = ['field', 'entity_test', 'user', 'views_test_formatter', 'views_entity_test'];
 
   /**
    * {@inheritdoc}
@@ -234,13 +234,13 @@ public function testSimpleExecute() {
 
     $this->assertIdenticalResultset($executable,
       [
-        ['id' => 1, 'field_test' => 3],
-        ['id' => 2, 'field_test' => 0],
-        ['id' => 3, 'field_test' => 8],
-        ['id' => 4, 'field_test' => 5],
-        ['id' => 5, 'field_test' => 6],
+        ['id' => 1, 'field_test' => 3, 'user_id' => 2],
+        ['id' => 2, 'field_test' => 0, 'user_id' => 3],
+        ['id' => 3, 'field_test' => 8, 'user_id' => 4],
+        ['id' => 4, 'field_test' => 5, 'user_id' => 5],
+        ['id' => 5, 'field_test' => 6, 'user_id' => 6],
       ],
-      ['id' => 'id', 'field_test' => 'field_test']
+      ['id' => 'id', 'field_test' => 'field_test', 'user_id' => 'user_id']
     );
   }
 
