public function PublishOnlyRenderedTest::testOnPrunePublishCdfEntities in Acquia Lift Connector 8.4
@covers ::onPrunePublishCdfEntities
Throws
\Exception
File
- modules/
acquia_lift_publisher/ tests/ src/ Kernel/ EventSubscriber/ Publish/ PublishOnlyRenderedTest.php, line 187
Class
- PublishOnlyRenderedTest
- Class PublishOnlyRenderedTest.
Namespace
Drupal\Tests\acquia_lift_publisher\Kernel\EventSubscriber\PublishCode
public function testOnPrunePublishCdfEntities() {
$client = $this->container
->get('acquia_contenthub.client.factory')
->getClient();
// Provide mock data.
$cdf_mock = $this
->getCdfMock();
$document = new CDFDocument(...$cdf_mock->original);
$unfiltered = $document
->getEntities();
$event = new PrunePublishCdfEntitiesEvent($client, $document, '175b8909-b873-4e8d-b054-896ba0293c46');
$this->eventDispatcher
->dispatch(AcquiaContentHubEvents::PRUNE_PUBLISH_CDF_ENTITIES, $event);
$pruned = $event
->getDocument()
->getEntities();
$this
->assertGreaterThan($pruned, $unfiltered, 'Unnecessary content was removed from the CDF document');
// Add the pruned CDF to the CDF test object, carry out assertions.
$cdf_mock->pruned = $pruned;
$this
->assertContainsOnlyRequiredCdfs($cdf_mock);
}