public function EntityListBuilderTest::testDisplaySettings in Apigee Edge 8
Tests display settings for list builder.
Throws
\Drupal\Core\Entity\EntityStorageException
File
- tests/
src/ Kernel/ Entity/ ListBuilder/ EntityListBuilderTest.php, line 137
Class
- EntityListBuilderTest
- Tests for EntityListBuilder.
Namespace
Drupal\Tests\apigee_edge\Kernel\Entity\ListBuilderCode
public function testDisplaySettings() {
/** @var \Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager */
$entity_type_manager = $this->container
->get('entity_type.manager');
$this->app = $this
->createDeveloperApp();
$this->stack
->queueMockResponse([
'get_developer_apps' => [
'apps' => [
$this->app,
],
],
]);
// Using default.
$build = $entity_type_manager
->getListBuilder(static::ENTITY_TYPE)
->render();
static::assertTrue(isset($build['table']));
// Add view mode.
EntityViewMode::create([
'id' => static::ENTITY_TYPE . '.foo',
'targetEntityType' => static::ENTITY_TYPE,
'label' => 'Foo',
'status' => TRUE,
])
->save();
$config = $this
->config('apigee_edge.display_settings.' . static::ENTITY_TYPE);
$config
->set('display_type', 'view_mode')
->set('view_mode', 'foo')
->save();
// Using view mode.
$build = $entity_type_manager
->getListBuilder(static::ENTITY_TYPE)
->render();
static::assertSame('apigee_entity_list', $build['#type']);
static::assertSame('foo', $build['#view_mode']);
}