public function CreateModeratedForwardRevisionTest::testCreateModFwdRevisionWithoutConfig in Acquia Content Hub 8.2
Tests CreateModeratedForwardRevision event subscriber without config.
File
- tests/
src/ Kernel/ EventSubscriber/ ModeratedRevisions/ CreateModeratedForwardRevisionTest.php, line 129
Class
- CreateModeratedForwardRevisionTest
- Test that moderation state is correctly handled in PreEntitySave event.
Namespace
Drupal\Tests\acquia_contenthub\Kernel\EventSubscriber\PreEntitySaveCode
public function testCreateModFwdRevisionWithoutConfig() : void {
$stack = $this
->prophesize(DependencyStack::class);
$cdf = $this
->prophesize(CDFObject::class);
$event = new PreEntitySaveEvent($this->node, $stack
->reveal(), $cdf
->reveal());
$create_forward_revision = new CreateModeratedForwardRevision($this->container
->get('entity_type.manager'), $this->container
->get('config.factory'), $this->container
->get('content_moderation.moderation_information'), $this->container
->get('logger.factory'));
$create_forward_revision
->onPreEntitySave($event);
/** @var \Drupal\node\NodeInterface $entity */
$entity = $event
->getEntity();
$mod_state = $entity
->get('moderation_state')
->getString();
$this
->assertEqual('draft', $mod_state);
}