public function BundlelessEntityTest::testViewModes in Search API 8
Tests that view modes are returned correctly.
File
- tests/
src/ Kernel/ Datasource/ BundlelessEntityTest.php, line 68
Class
- BundlelessEntityTest
- Tests indexing entities that use string IDs.
Namespace
Drupal\Tests\search_api\Kernel\DatasourceCode
public function testViewModes() {
$datasource = $this->index
->getDatasource('entity:' . $this->testEntityTypeId);
$bundles = $datasource
->getBundles();
$expected = [
'user' => 'User',
];
$this
->assertEquals($expected, $bundles);
$view_modes = $datasource
->getViewModes('user');
$expected = [
'compact' => 'Compact',
'default' => 'Default',
'full' => 'User account',
];
ksort($view_modes);
$this
->assertEquals($expected, $view_modes);
$view_modes = $datasource
->getViewModes();
ksort($view_modes);
$this
->assertEquals($expected, $view_modes);
}