$result =
$this->
xpath($header_xpath);
$this->
assertStringContainsString($entities[0
]->
label(),
(string) $result[0
], 'The rendered entity appears in the header of the view.'
);
$this->
assertStringContainsString('full',
(string) $result[0
], 'The rendered entity appeared in the right view mode.'
);
$result =
$this->
xpath($footer_xpath);
$this->
assertStringContainsString($entities[1
]->
label(),
(string) $result[0
], 'The rendered entity appears in the footer of the view.'
);
$this->
assertStringContainsString('full',
(string) $result[0
], 'The rendered entity appeared in the right view mode.'
);
// Mark entity_test test view_mode as customizable.
$entity_view_mode = \Drupal::
entityTypeManager()->
getStorage('entity_view_mode'
)->
load('entity_test.test'
);
$entity_view_mode->
enable();
$entity_view_mode->
save();
// Change the view mode of the area handler.
$view = Views::
getView('test_entity_area'
);
$item =
$view->
getHandler('default', 'header', 'entity_entity_test'
);
$item['view_mode'
] = 'test';
$view->
setHandler('default', 'header', 'entity_entity_test',
$item);
$preview =
$view->
preview('default',
[$entities[1
]->
id()]);
$this->
setRawContent($renderer->
renderRoot($preview));
$view_class = 'js-view-dom-id-' .
$view->dom_id;