You are here

protected function EntityRenderHandlerTest::enableViewModeExportFor in Acquia Lift Connector 8.4

Enables view mode for certain entity rendered with the provided role.

Parameters

\Drupal\Core\Entity\EntityInterface $entity: The entity to enable export for.

string $render_role: The user role to render the entity with.

Throws

\Exception

4 calls to EntityRenderHandlerTest::enableViewModeExportFor()
EntityRenderHandlerTest::testImageAttributeIsSet in modules/acquia_lift_publisher/tests/src/Kernel/EventSubscriber/Cdf/EntityRenderHandlerTest.php
@covers ::onCreateCdf
EntityRenderHandlerTest::testOnCreateCdfBlockContent in modules/acquia_lift_publisher/tests/src/Kernel/EventSubscriber/Cdf/EntityRenderHandlerTest.php
@covers ::onCreateCdf
EntityRenderHandlerTest::testOnCreateCdfConfigEntity in modules/acquia_lift_publisher/tests/src/Kernel/EventSubscriber/Cdf/EntityRenderHandlerTest.php
@covers ::onCreateCdf
EntityRenderHandlerTest::testOnCreateCdfMetadataSetCorrectly in modules/acquia_lift_publisher/tests/src/Kernel/EventSubscriber/Cdf/EntityRenderHandlerTest.php
@covers ::onCreateCdf

File

modules/acquia_lift_publisher/tests/src/Kernel/EventSubscriber/Cdf/EntityRenderHandlerTest.php, line 391

Class

EntityRenderHandlerTest
Class EntityRenderHandlerTest.

Namespace

Drupal\Tests\acquia_lift_publisher\Kernel\EventSubscriber\Cdf

Code

protected function enableViewModeExportFor(EntityInterface $entity, string $render_role = 'anonymous') : void {
  $config = $this->container
    ->get('config.factory')
    ->getEditable('acquia_lift_publisher.entity_config');
  $config
    ->set("view_modes.{$entity->getEntityTypeId()}.{$entity->bundle()}", [
    'full' => 1,
  ])
    ->set("view_modes.node.article.acquia_lift_preview_image", 'field_image_test')
    ->set('render_role', $render_role)
    ->save();
  $config = $this->container
    ->get('config.factory')
    ->get('acquia_lift_publisher.entity_config');
  $this->container
    ->set('acquia_lift_publisher.publishing_settings', $config);
}