diff core/modules/views/src/Tests/ViewResultAssertionTrait.php @ 12:7a779792577d

Update Drupal core to v8.4.5 (via Composer)
author Chris Cannam
date Fri, 23 Feb 2018 15:52:07 +0000
parents 4c8ae668cc8c
children
line wrap: on
line diff
--- a/core/modules/views/src/Tests/ViewResultAssertionTrait.php	Fri Feb 23 15:51:18 2018 +0000
+++ b/core/modules/views/src/Tests/ViewResultAssertionTrait.php	Fri Feb 23 15:52:07 2018 +0000
@@ -88,7 +88,6 @@
         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 @@
           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;