You are here

protected function EntityRenderHandlerTest::dispatchWith in Acquia Lift Connector 8.4

Dispatches the event in hand with an arbitrary input parameters.

Parameters

\Drupal\Core\Entity\EntityInterface $entity: The entity to use in the event.

array $dependencies: The dependency stack.

Return value

\Drupal\acquia_contenthub\Event\CreateCdfEntityEvent The altered event.

Throws

\Exception

4 calls to EntityRenderHandlerTest::dispatchWith()
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 271

Class

EntityRenderHandlerTest
Class EntityRenderHandlerTest.

Namespace

Drupal\Tests\acquia_lift_publisher\Kernel\EventSubscriber\Cdf

Code

protected function dispatchWith(EntityInterface $entity, array $dependencies) : CreateCdfEntityEvent {

  // Start with a clean sheet. It is possible that the container's
  // content has been modified.
  $handler = new EntityRenderHandler($this->container
    ->get('account_switcher'), $this->container
    ->get('acquia_lift_publisher.publishing_settings'), $this->container
    ->get('renderer'), $this->container
    ->get('entity_type.manager'), $this->container
    ->get('plugin.manager.block'), $this->container
    ->get('uuid'), $this->container
    ->get('acquia_contenthub.client.factory'), $this->container
    ->get('language.default'), $this->container
    ->get('string_translation'));
  $this->container
    ->set('acquia_lift.service.entity_render.cdf.handler', $handler);
  $event = new CreateCdfEntityEvent($entity, $dependencies);
  $this->container
    ->get('event_dispatcher')
    ->dispatch(AcquiaContentHubEvents::CREATE_CDF_OBJECT, $event);
  return $event;
}