You are here

public function AcquiaContentHubSerializerTestBase::dispatchSerializeEvent in Acquia Content Hub 8.2

Get the CDF being created.

Parameters

string $field_name: Field name.

\Drupal\Core\Field\FieldItemList $field: Field items list.

Return value

\Drupal\acquia_contenthub\Event\SerializeCdfEntityFieldEvent The CDF object.

3 calls to AcquiaContentHubSerializerTestBase::dispatchSerializeEvent()
MetatagFieldSerializerTest::testTransformMetatagValues in modules/acquia_contenthub_metatag/tests/src/Kernel/EventSubscriber/SerializeContentField/MetatagFieldSerializerTest.php
Tests the serialization of the metatag field.
PathFieldSerializerTest::testNodePathFieldSerialization in tests/src/Kernel/EventSubscriber/SerializeContentField/PathFieldSerializerTest.php
Tests the serialization of the node path field.
PathFieldSerializerTest::testPathFieldSerialization in tests/src/Kernel/EventSubscriber/SerializeContentField/PathFieldSerializerTest.php
Tests the serialization of the path field.

File

tests/src/Kernel/AcquiaContentHubSerializerTestBase.php, line 194

Class

AcquiaContentHubSerializerTestBase
Base class for testing serialization.

Namespace

Drupal\Tests\acquia_contenthub\Kernel

Code

public function dispatchSerializeEvent(string $field_name, FieldItemList $field) : SerializeCdfEntityFieldEvent {
  $settings = $this->clientFactory
    ->getClient()
    ->getSettings();
  $cdf = new CDFObject('drupal8_content_entity', $this->entity
    ->uuid(), date('c'), date('c'), $settings
    ->getUuid());
  $event = new SerializeCdfEntityFieldEvent($this->entity, $field_name, $field, $cdf);
  $this->dispatcher
    ->dispatch(AcquiaContentHubEvents::SERIALIZE_CONTENT_ENTITY_FIELD, $event);

  // Check propagationStopped property is changed.
  $this
    ->assertTrue($event
    ->isPropagationStopped());
  return $event;
}