Mercurial > hg > isophonics-drupal-site
comparison 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 |
comparison
equal
deleted
inserted
replaced
11:bfffd8d7479a | 12:7a779792577d |
---|---|
86 $row = []; | 86 $row = []; |
87 foreach ($column_map as $view_column => $expected_column) { | 87 foreach ($column_map as $view_column => $expected_column) { |
88 if (property_exists($value, $view_column)) { | 88 if (property_exists($value, $view_column)) { |
89 $row[$expected_column] = (string) $value->$view_column; | 89 $row[$expected_column] = (string) $value->$view_column; |
90 } | 90 } |
91 // The comparison will be done on the string representation of the value. | |
92 // For entity fields we don't have the raw value. Let's try to fetch it | 91 // For entity fields we don't have the raw value. Let's try to fetch it |
93 // using the entity itself. | 92 // using the entity itself. |
94 elseif (empty($value->$view_column) && isset($view->field[$expected_column]) && ($field = $view->field[$expected_column]) && $field instanceof EntityField) { | 93 elseif (empty($value->$view_column) && isset($view->field[$expected_column]) && ($field = $view->field[$expected_column]) && $field instanceof EntityField) { |
95 $column = NULL; | 94 $column = NULL; |
96 if (count(explode(':', $view_column)) == 2) { | 95 if (count(explode(':', $view_column)) == 2) { |
97 $column = explode(':', $view_column)[1]; | 96 $column = explode(':', $view_column)[1]; |
98 } | 97 } |
99 $row[$expected_column] = $field->getValue($value, $column); | 98 // The comparison will be done on the string representation of the |
99 // value. | |
100 $field_value = $field->getValue($value, $column); | |
101 $row[$expected_column] = is_array($field_value) ? array_map('strval', $field_value) : (string) $field_value; | |
100 } | 102 } |
101 } | 103 } |
102 $result[$key] = $row; | 104 $result[$key] = $row; |
103 } | 105 } |
104 | 106 |