diff --git a/core/modules/views/src/Tests/ViewTestBase.php b/core/modules/views/src/Tests/ViewTestBase.php index c33776d..70a958a 100644 --- a/core/modules/views/src/Tests/ViewTestBase.php +++ b/core/modules/views/src/Tests/ViewTestBase.php @@ -9,6 +9,7 @@ use Drupal\Core\Database\Query\SelectInterface; use Drupal\simpletest\WebTestBase; +use Drupal\views\Plugin\views\field\Field; use Drupal\views\ViewExecutable; /** @@ -147,8 +148,14 @@ protected function assertIdenticalResultsetHelper(ViewExecutable $view, $expecte 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; + if (isset($value->$view_column)) { + $row[$expected_column] = (string) $value->$view_column; + } + // 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 Field) { + $row[$expected_column] = $field->getEntity($value)->{$field->definition['field_name']}->value; + } } $result[$key] = $row; }