diff -u b/core/modules/content_moderation/content_moderation.module b/core/modules/content_moderation/content_moderation.module --- b/core/modules/content_moderation/content_moderation.module +++ b/core/modules/content_moderation/content_moderation.module @@ -57,30 +57,6 @@ } /** - * Implements hook_module_implements_alter(). - */ -function content_moderation_module_implements_alter(&$implementations, $hook) { - if ($hook === 'entity_view_alter') { - // Move the content_moderation implementation to the end of the list. - $group = $implementations['content_moderation']; - unset($implementations['content_moderation']); - $implementations['content_moderation'] = $group; - } -} - -/** - * Implements hook_entity_view_alter(). - */ -function content_moderation_entity_view_alter(&$build, EntityInterface $entity, EntityViewDisplayInterface $display) { - $moderation_information = \Drupal::service('content_moderation.moderation_information'); - if ($moderation_information->isModeratableEntity($entity) && !$moderation_information->isLatestRevision($entity)) { - // Hide quickedit, because its super confusing for the user to not edit the - // live revision. - unset($build['#attributes']['data-quickedit-entity-id']); - } -} - -/** * Implements hook_entity_type_alter(). */ function content_moderation_entity_type_alter(array &$entity_types) { @@ -192,7 +168,7 @@ * mandatory for any user that wants to moderate things. */ function content_moderation_node_access(NodeInterface $node, $operation, AccountInterface $account) { - /** @var \Drupal\content_moderation\ModerationInformationInterface $modinfo */ + /** @var \Drupal\content_moderation\ModerationInformationInterface $moderation_info */ $moderation_info = Drupal::service('content_moderation.moderation_information'); $access_result = NULL; @@ -203,7 +179,7 @@ $access_result->addCacheableDependency($node); } - elseif ($operation === 'update' && $moderation_info->isModeratableEntity($node) && $node->moderation_state && $node->moderation_state->target_id) { + elseif ($operation === 'update' && $moderation_info->isModeratedEntity($node) && $node->moderation_state && $node->moderation_state->target_id) { /** @var \Drupal\content_moderation\StateTransitionValidation $transition_validation */ $transition_validation = \Drupal::service('content_moderation.state_transition_validation'); diff -u b/core/modules/content_moderation/src/Entity/Handler/ModerationHandlerInterface.php b/core/modules/content_moderation/src/Entity/Handler/ModerationHandlerInterface.php --- b/core/modules/content_moderation/src/Entity/Handler/ModerationHandlerInterface.php +++ b/core/modules/content_moderation/src/Entity/Handler/ModerationHandlerInterface.php @@ -16,7 +16,7 @@ interface ModerationHandlerInterface { /** - * Operates on moderatable content entities preSave(). + * Operates on moderated content entities preSave(). * * @param \Drupal\Core\Entity\ContentEntityInterface $entity * The entity to modify. @@ -28,7 +28,7 @@ public function onPresave(ContentEntityInterface $entity, $default_revision, $published_state); /** - * Operates on the bundle definition that has been marked as moderatable. + * Operates on the bundle definition that has been marked as moderated. * * Note: The values on the EntityModerationForm itself are already saved * so do not need to be saved here. If any changes are made to the bundle diff -u b/core/modules/content_moderation/src/EntityOperations.php b/core/modules/content_moderation/src/EntityOperations.php --- b/core/modules/content_moderation/src/EntityOperations.php +++ b/core/modules/content_moderation/src/EntityOperations.php @@ -96,7 +96,7 @@ * The entity being saved. */ public function entityPresave(EntityInterface $entity) { - if (!$this->moderationInfo->isModeratableEntity($entity)) { + if (!$this->moderationInfo->isModeratedEntity($entity)) { return; } if ($entity->moderation_state->target_id) { @@ -125,11 +125,10 @@ * @see hook_entity_insert() */ public function entityInsert(EntityInterface $entity) { - if (!$this->moderationInfo->isModeratableEntity($entity)) { - return; + if ($this->moderationInfo->isModeratedEntity($entity)) { + $this->updateOrCreateFromEntity($entity); + $this->setLatestRevision($entity); } - $this->updateOrCreateFromEntity($entity); - $this->setLatestRevision($entity); } /** @@ -141,11 +140,10 @@ * @see hook_entity_update() */ public function entityUpdate(EntityInterface $entity) { - if (!$this->moderationInfo->isModeratableEntity($entity)) { - return; + if ($this->moderationInfo->isModeratedEntity($entity)) { + $this->updateOrCreateFromEntity($entity); + $this->setLatestRevision($entity); } - $this->updateOrCreateFromEntity($entity); - $this->setLatestRevision($entity); } /** @@ -227,7 +225,7 @@ * @see EntityFieldManagerInterface::getExtraFields() */ public function entityView(array &$build, EntityInterface $entity, EntityViewDisplayInterface $display, $view_mode) { - if (!$this->moderationInfo->isModeratableEntity($entity)) { + if (!$this->moderationInfo->isModeratedEntity($entity)) { return; } if (!$this->moderationInfo->isLatestRevision($entity)) { diff -u b/core/modules/content_moderation/src/EntityTypeInfo.php b/core/modules/content_moderation/src/EntityTypeInfo.php --- b/core/modules/content_moderation/src/EntityTypeInfo.php +++ b/core/modules/content_moderation/src/EntityTypeInfo.php @@ -170,7 +170,7 @@ $operations = []; $type = $entity->getEntityType(); - if ($this->moderationInfo->isBundleForModeratableEntity($entity)) { + if ($this->moderationInfo->isBundleForModeratedEntity($entity)) { $operations['manage-moderation'] = [ 'title' => t('Manage moderation'), 'weight' => 27, @@ -259,7 +259,7 @@ * New fields added by moderation state. */ public function entityBaseFieldInfo(EntityTypeInterface $entity_type) { - if (!$this->moderationInfo->isModeratableEntityType($entity_type)) { + if (!$this->moderationInfo->isModeratedEntityType($entity_type)) { return []; } @@ -289,7 +289,7 @@ } /** - * Adds the ModerationState constraint to bundles that are moderatable. + * Adds the ModerationState constraint to bundles that are moderated. * * @param \Drupal\Core\Field\FieldDefinitionInterface[] $fields * The array of bundle field definitions. @@ -301,7 +301,7 @@ * @see hook_entity_bundle_field_info_alter(); */ public function entityBundleFieldInfoAlter(&$fields, EntityTypeInterface $entity_type, $bundle) { - if ($this->moderationInfo->isModeratableBundle($entity_type, $bundle) && !empty($fields['moderation_state'])) { + if (!empty($fields['moderation_state']) && $this->moderationInfo->isModeratedBundle($entity_type, $bundle)) { $fields['moderation_state']->addConstraint('ModerationState', []); } } diff -u b/core/modules/content_moderation/src/Form/ModerationStateForm.php b/core/modules/content_moderation/src/Form/ModerationStateForm.php --- b/core/modules/content_moderation/src/Form/ModerationStateForm.php +++ b/core/modules/content_moderation/src/Form/ModerationStateForm.php @@ -24,7 +24,7 @@ '#title' => $this->t('Label'), '#maxlength' => 255, '#default_value' => $moderation_state->label(), - '#description' => $this->t("Label for the Moderation state."), + '#description' => $this->t('Label for the Moderation state.'), '#required' => TRUE, ); diff -u b/core/modules/content_moderation/src/Form/ModerationStateTransitionForm.php b/core/modules/content_moderation/src/Form/ModerationStateTransitionForm.php --- b/core/modules/content_moderation/src/Form/ModerationStateTransitionForm.php +++ b/core/modules/content_moderation/src/Form/ModerationStateTransitionForm.php @@ -62,7 +62,7 @@ '#title' => $this->t('Label'), '#maxlength' => 255, '#default_value' => $moderation_state_transition->label(), - '#description' => $this->t("Label for the Moderation state transition."), + '#description' => $this->t('Label for the Moderation state transition.'), '#required' => TRUE, ]; diff -u b/core/modules/content_moderation/src/ModerationInformation.php b/core/modules/content_moderation/src/ModerationInformation.php --- b/core/modules/content_moderation/src/ModerationInformation.php +++ b/core/modules/content_moderation/src/ModerationInformation.php @@ -48,18 +48,18 @@ /** * {@inheritdoc} */ - public function isModeratableEntity(EntityInterface $entity) { + public function isModeratedEntity(EntityInterface $entity) { if (!$entity instanceof ContentEntityInterface) { return FALSE; } - return $this->isModeratableBundle($entity->getEntityType(), $entity->bundle()); + return $this->isModeratedBundle($entity->getEntityType(), $entity->bundle()); } /** * {@inheritdoc} */ - public function isModeratableEntityType(EntityTypeInterface $entity_type) { + public function isModeratedEntityType(EntityTypeInterface $entity_type) { return $entity_type->hasHandlerClass('moderation'); } @@ -75,7 +75,7 @@ /** * {@inheritdoc} */ - public function isModeratableBundle(EntityTypeInterface $entity_type, $bundle) { + public function isModeratedBundle(EntityTypeInterface $entity_type, $bundle) { if ($bundle_entity = $this->loadBundleEntity($entity_type->getBundleEntityType(), $bundle)) { return $bundle_entity->getThirdPartySetting('content_moderation', 'enabled', FALSE); } @@ -107,7 +107,7 @@ /** * {@inheritdoc} */ - public function isBundleForModeratableEntity(EntityInterface $entity) { + public function isBundleForModeratedEntity(EntityInterface $entity) { $type = $entity->getEntityType(); return @@ -122,7 +122,7 @@ */ public function isModeratedEntityForm(FormInterface $form_object) { return $form_object instanceof ContentEntityFormInterface - && $this->isModeratableEntity($form_object->getEntity()); + && $this->isModeratedEntity($form_object->getEntity()); } /** @@ -159,8 +159,7 @@ ->range(0, 1) ->execute(); if ($revision_ids) { - $revision_id = array_keys($revision_ids)[0]; - return $revision_id; + return array_keys($revision_ids)[0]; } } } @@ -176,8 +175,7 @@ ->range(0, 1) ->execute(); if ($revision_ids) { - $revision_id = array_keys($revision_ids)[0]; - return $revision_id; + return array_keys($revision_ids)[0]; } } } @@ -193,7 +191,7 @@ * {@inheritdoc} */ public function hasForwardRevision(ContentEntityInterface $entity) { - return $this->isModeratableEntity($entity) + return $this->isModeratedEntity($entity) && !($this->getLatestRevisionId($entity->getEntityTypeId(), $entity->id()) == $this->getDefaultRevisionId($entity->getEntityTypeId(), $entity->id())); } diff -u b/core/modules/content_moderation/src/ModerationInformationInterface.php b/core/modules/content_moderation/src/ModerationInformationInterface.php --- b/core/modules/content_moderation/src/ModerationInformationInterface.php +++ b/core/modules/content_moderation/src/ModerationInformationInterface.php @@ -26,29 +26,29 @@ public function loadBundleEntity($bundle_entity_type_id, $bundle_id); /** - * Determines if an entity is one we should be moderating. + * Determines if an entity is moderated. * * @param \Drupal\Core\Entity\EntityInterface $entity * The entity we may be moderating. * * @return bool - * TRUE if this is an entity that we should act upon, FALSE otherwise. + * TRUE if this is an entity tis moderated, FALSE otherwise. */ - public function isModeratableEntity(EntityInterface $entity); + public function isModeratedEntity(EntityInterface $entity); /** - * Determines if an entity type has been marked as moderatable. + * Determines if an entity type is moderated. * * @param \Drupal\Core\Entity\EntityTypeInterface $entity_type * An entity type object. * * @return bool - * TRUE if this entity type has been marked as moderatable, FALSE otherwise. + * TRUE if this entity type is moderated, FALSE otherwise. */ - public function isModeratableEntityType(EntityTypeInterface $entity_type); + public function isModeratedEntityType(EntityTypeInterface $entity_type); /** - * Determines if an entity type/bundle is one that will be moderated. + * Determines if an entity type/bundle is moderated. * * @param \Drupal\Core\Entity\EntityTypeInterface $entity_type * The entity type definition to check. @@ -56,9 +56,9 @@ * The bundle to check. * * @return bool - * TRUE if this is a bundle we want to moderate, FALSE otherwise. + * TRUE if this is a bundle is moderated, FALSE otherwise. */ - public function isModeratableBundle(EntityTypeInterface $entity_type, $bundle); + public function isModeratedBundle(EntityTypeInterface $entity_type, $bundle); /** * Filters entity lists to just bundle definitions for revisionable entities. @@ -72,16 +72,16 @@ public function selectRevisionableEntityTypes(array $entity_types); /** - * Filters entity lists to just the definitions for moderatable entities. + * Filters entity lists to just the definitions that can be moderated. * - * An entity type is moderatable only if it is both revisionable and + * An entity type can be moderated only if it is both revisionable and * bundleable. * * @param EntityTypeInterface[] $entity_types * The master entity type list filter. * * @return \Drupal\Core\Entity\ContentEntityTypeInterface[] - * An array of only the content entity definitions we want to modify. + * An array of only the content entity definitions that can be moderated. */ public function selectRevisionableEntities(array $entity_types); @@ -101,7 +101,7 @@ * TRUE if we want to add a Moderation operation to this entity, FALSE * otherwise. */ - public function isBundleForModeratableEntity(EntityInterface $entity); + public function isBundleForModeratedEntity(EntityInterface $entity); /** * Determines if this form is for a moderated entity. diff -u b/core/modules/content_moderation/src/ParamConverter/EntityRevisionConverter.php b/core/modules/content_moderation/src/ParamConverter/EntityRevisionConverter.php --- b/core/modules/content_moderation/src/ParamConverter/EntityRevisionConverter.php +++ b/core/modules/content_moderation/src/ParamConverter/EntityRevisionConverter.php @@ -47,8 +47,8 @@ /** * Determines if the route definition includes a forward-revision flag. * - * This is a custom flag defined by WBM to load forward revisions rather than - * the default revision on a given route. + * This is a custom flag defined by the Content Moderation module to load + * forward revisions rather than the default revision on a given route. * * @param array $definition * The parameter definition provided in the route options. @@ -88,7 +88,7 @@ public function convert($value, $definition, $name, array $defaults) { $entity = parent::convert($value, $definition, $name, $defaults); - if ($entity && $this->moderationInformation->isModeratableEntity($entity) && !$this->moderationInformation->isLatestRevision($entity)) { + if ($entity && $this->moderationInformation->isModeratedEntity($entity) && !$this->moderationInformation->isLatestRevision($entity)) { $entity_type_id = $this->getEntityTypeFromDefaults($definition, $name, $defaults); $latest_revision = $this->moderationInformation->getLatestRevision($entity_type_id, $value); diff -u b/core/modules/content_moderation/src/Plugin/Action/ModerationOptOutPublishNode.php b/core/modules/content_moderation/src/Plugin/Action/ModerationOptOutPublishNode.php --- b/core/modules/content_moderation/src/Plugin/Action/ModerationOptOutPublishNode.php +++ b/core/modules/content_moderation/src/Plugin/Action/ModerationOptOutPublishNode.php @@ -54,7 +54,7 @@ * {@inheritdoc} */ public function execute($entity = NULL) { - if ($entity && $this->moderationInfo->isModeratableEntity($entity)) { + if ($entity && $this->moderationInfo->isModeratedEntity($entity)) { drupal_set_message($this->t('One or more entities were skipped as they are under moderation and may not be directly published or unpublished.')); return; } @@ -67,7 +67,7 @@ */ public function access($object, AccountInterface $account = NULL, $return_as_object = FALSE) { $result = parent::access($object, $account, TRUE) - ->andif(AccessResult::forbiddenIf($this->moderationInfo->isModeratableEntity($object))->addCacheableDependency($object)); + ->andif(AccessResult::forbiddenIf($this->moderationInfo->isModeratedEntity($object))->addCacheableDependency($object)); return $return_as_object ? $result : $result->isAllowed(); } diff -u b/core/modules/content_moderation/src/Plugin/Action/ModerationOptOutUnpublishNode.php b/core/modules/content_moderation/src/Plugin/Action/ModerationOptOutUnpublishNode.php --- b/core/modules/content_moderation/src/Plugin/Action/ModerationOptOutUnpublishNode.php +++ b/core/modules/content_moderation/src/Plugin/Action/ModerationOptOutUnpublishNode.php @@ -54,7 +54,7 @@ * {@inheritdoc} */ public function execute($entity = NULL) { - if ($entity && $this->moderationInfo->isModeratableEntity($entity)) { + if ($entity && $this->moderationInfo->isModeratedEntity($entity)) { drupal_set_message($this->t('One or more entities were skipped as they are under moderation and may not be directly published or unpublished.')); return; } @@ -67,7 +67,7 @@ */ public function access($object, AccountInterface $account = NULL, $return_as_object = FALSE) { $result = parent::access($object, $account, TRUE) - ->andif(AccessResult::forbiddenIf($this->moderationInfo->isModeratableEntity($object))->addCacheableDependency($object)); + ->andif(AccessResult::forbiddenIf($this->moderationInfo->isModeratedEntity($object))->addCacheableDependency($object)); return $return_as_object ? $result : $result->isAllowed(); } diff -u b/core/modules/content_moderation/src/Plugin/Derivative/DynamicLocalTasks.php b/core/modules/content_moderation/src/Plugin/Derivative/DynamicLocalTasks.php --- b/core/modules/content_moderation/src/Plugin/Derivative/DynamicLocalTasks.php +++ b/core/modules/content_moderation/src/Plugin/Derivative/DynamicLocalTasks.php @@ -48,6 +48,8 @@ * The entity type manager. * @param \Drupal\Core\StringTranslation\TranslationInterface $string_translation * The translation manager. + * @param \Drupal\content_moderation\ModerationInformationInterface $moderation_information + * The moderation information service. */ public function __construct($base_plugin_id, EntityTypeManagerInterface $entity_type_manager, TranslationInterface $string_translation, ModerationInformationInterface $moderation_information) { $this->entityTypeManager = $entity_type_manager; @@ -74,7 +76,7 @@ public function getDerivativeDefinitions($base_plugin_definition) { $this->derivatives = []; - foreach ($this->moderatableEntityTypeDefinitions() as $entity_type_id => $entity_type) { + foreach ($this->moderatedEntityTypeDefinitions() as $entity_type_id => $entity_type) { $this->derivatives["$entity_type_id.moderation_tab"] = [ 'route_name' => "entity.$entity_type_id.moderation", 'title' => $this->t('Manage moderation'), @@ -84,7 +86,7 @@ ] + $base_plugin_definition; } - $latest_version_entities = array_filter($this->moderatableEntityDefinitions(), function (EntityTypeInterface $type) { + $latest_version_entities = array_filter($this->moderatedEntityDefinitions(), function (EntityTypeInterface $type) { return $type->hasLinkTemplate('latest-version'); }); @@ -101,12 +103,12 @@ } /** - * Returns an array of content entities that are potentially moderatable. + * Returns an array of content entities that are potentially moderated. * * @return EntityTypeInterface[] * An array of just those entities we care about. */ - protected function moderatableEntityDefinitions() { + protected function moderatedEntityDefinitions() { return $this->moderationInfo->selectRevisionableEntities($this->entityTypeManager->getDefinitions()); } @@ -116,7 +118,7 @@ * @return EntityTypeInterface[] * An array of entity types that represent bundles that can be moderated. */ - protected function moderatableEntityTypeDefinitions() { + protected function moderatedEntityTypeDefinitions() { return $this->moderationInfo->selectRevisionableEntityTypes($this->entityTypeManager->getDefinitions()); } diff -u b/core/modules/content_moderation/src/Plugin/Field/FieldWidget/ModerationStateWidget.php b/core/modules/content_moderation/src/Plugin/Field/FieldWidget/ModerationStateWidget.php --- b/core/modules/content_moderation/src/Plugin/Field/FieldWidget/ModerationStateWidget.php +++ b/core/modules/content_moderation/src/Plugin/Field/FieldWidget/ModerationStateWidget.php @@ -93,12 +93,18 @@ * Third party settings. * @param \Drupal\Core\Session\AccountInterface $current_user * Current user service. + * @param \Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager + * Entity type manager. * @param \Drupal\Core\Entity\EntityStorageInterface $moderation_state_storage * Moderation state storage. * @param \Drupal\Core\Entity\EntityStorageInterface $moderation_state_transition_storage * Moderation state transition storage. * @param \Drupal\Core\Entity\Query\QueryInterface $entity_query * Moderation transition entity query service. + * @param \Drupal\content_moderation\ModerationInformation $moderation_information + * Moderation information service. + * @param \Drupal\content_moderation\StateTransitionValidation $validator + * Moderation state transition validation service */ public function __construct($plugin_id, $plugin_definition, FieldDefinitionInterface $field_definition, array $settings, array $third_party_settings, AccountInterface $current_user, EntityTypeManagerInterface $entity_type_manager, EntityStorageInterface $moderation_state_storage, EntityStorageInterface $moderation_state_transition_storage, QueryInterface $entity_query, ModerationInformation $moderation_information, StateTransitionValidation $validator) { parent::__construct($plugin_id, $plugin_definition, $field_definition, $settings, $third_party_settings); @@ -140,7 +146,7 @@ /* @var \Drupal\Core\Config\Entity\ConfigEntityInterface $bundle_entity */ $bundle_entity = $this->entityTypeManager->getStorage($entity->getEntityType()->getBundleEntityType())->load($entity->bundle()); - if (!$this->moderationInformation->isModeratableEntity($entity)) { + if (!$this->moderationInformation->isModeratedEntity($entity)) { // @todo write a test for this. return $element + ['#access' => FALSE]; } diff -u b/core/modules/content_moderation/src/Plugin/Menu/EditTab.php b/core/modules/content_moderation/src/Plugin/Menu/EditTab.php --- b/core/modules/content_moderation/src/Plugin/Menu/EditTab.php +++ b/core/modules/content_moderation/src/Plugin/Menu/EditTab.php @@ -78,7 +78,7 @@ * {@inheritdoc} */ public function getTitle() { - if (!$this->moderationInfo->isModeratableEntity($this->entity)) { + if (!$this->moderationInfo->isModeratedEntity($this->entity)) { // Moderation isn't enabled. return parent::getTitle(); } diff -u b/core/modules/content_moderation/src/Plugin/Validation/Constraint/ModerationStateConstraintValidator.php b/core/modules/content_moderation/src/Plugin/Validation/Constraint/ModerationStateConstraintValidator.php --- b/core/modules/content_moderation/src/Plugin/Validation/Constraint/ModerationStateConstraintValidator.php +++ b/core/modules/content_moderation/src/Plugin/Validation/Constraint/ModerationStateConstraintValidator.php @@ -73,7 +73,7 @@ $entity = $value->getEntity(); // Ignore entities that are not subject to moderation anyway. - if (!$this->moderationInformation->isModeratableEntity($entity)) { + if (!$this->moderationInformation->isModeratedEntity($entity)) { return; } diff -u b/core/modules/content_moderation/src/StateTransitionValidation.php b/core/modules/content_moderation/src/StateTransitionValidation.php --- b/core/modules/content_moderation/src/StateTransitionValidation.php +++ b/core/modules/content_moderation/src/StateTransitionValidation.php @@ -125,7 +125,7 @@ // filtered by those whose target is legal on this bundle and that the // user has access to execute. $transitions = array_filter($this->getTransitionsFrom($current_state_id), function(ModerationStateTransition $transition) use ($legal_bundle_states, $user) { - return in_array($transition->getToState(), $legal_bundle_states) + return in_array($transition->getToState(), $legal_bundle_states, TRUE) && $user->hasPermission('use ' . $transition->id() . ' transition'); }); diff -u b/core/modules/content_moderation/src/Tests/ModerationLocaleTest.php b/core/modules/content_moderation/src/Tests/ModerationLocaleTest.php --- b/core/modules/content_moderation/src/Tests/ModerationLocaleTest.php +++ b/core/modules/content_moderation/src/Tests/ModerationLocaleTest.php @@ -71,7 +71,7 @@ 'title[0][value]' => 'French node Draft', ]; $this->drupalPostForm(NULL, $edit, t('Save and Create New Draft (this translation)')); - // Here the error has occured "The website encountered an unexpected error. + // Here the error has occurred "The website encountered an unexpected error. // Please try again later." // If the translation has got lost. $this->assertText(t('Article French node Draft has been updated.')); @@ -126,7 +126,6 @@ $this->drupalPostForm(NULL, $edit, t('Save and Create New Draft (this translation)')); $this->assertText(t('Article Translated node has been updated.')); $english_node = $this->drupalGetNodeByTitle('Another node', TRUE); - $french_node = $english_node->getTranslation('fr'); // Publish the translation and check that the source language version stays // unpublished. diff -u b/core/modules/content_moderation/tests/src/Functional/ModerationStateAccessTest.php b/core/modules/content_moderation/tests/src/Functional/ModerationStateAccessTest.php --- b/core/modules/content_moderation/tests/src/Functional/ModerationStateAccessTest.php +++ b/core/modules/content_moderation/tests/src/Functional/ModerationStateAccessTest.php @@ -26,7 +26,7 @@ */ public function testViewShowsCorrectStates() { $node_type_id = 'test'; - $node_type = $this->createNodeType('Test', $node_type_id); + $this->createNodeType('Test', $node_type_id); $permissions = [ 'access content', diff -u b/core/modules/content_moderation/tests/src/Kernel/EntityOperationsTest.php b/core/modules/content_moderation/tests/src/Kernel/EntityOperationsTest.php --- b/core/modules/content_moderation/tests/src/Kernel/EntityOperationsTest.php +++ b/core/modules/content_moderation/tests/src/Kernel/EntityOperationsTest.php @@ -40,7 +40,7 @@ } /** - * Creates a page node type to test with, ensuring that it's moderatable. + * Creates a page node type to test with, ensuring that it's moderated. */ protected function createNodeType() { $node_type = NodeType::create([ diff -u b/core/modules/content_moderation/tests/src/Unit/ContentPreprocessTest.php b/core/modules/content_moderation/tests/src/Unit/ContentPreprocessTest.php --- b/core/modules/content_moderation/tests/src/Unit/ContentPreprocessTest.php +++ b/core/modules/content_moderation/tests/src/Unit/ContentPreprocessTest.php @@ -28,7 +28,7 @@ */ public function routeNodeProvider() { return [ - ['entity.node.cannonical', 1, 1, FALSE, 'Not on the latest version tab route.'], + ['entity.node.canonical', 1, 1, FALSE, 'Not on the latest version tab route.'], ['entity.node.latest_version', 1, 1, TRUE, 'On the latest version tab route, with the route node.'], ['entity.node.latest_version', 1, 2, FALSE, 'On the latest version tab route, with a different node.'], ]; diff -u b/core/modules/content_moderation/tests/src/Unit/ModerationInformationTest.php b/core/modules/content_moderation/tests/src/Unit/ModerationInformationTest.php --- b/core/modules/content_moderation/tests/src/Unit/ModerationInformationTest.php +++ b/core/modules/content_moderation/tests/src/Unit/ModerationInformationTest.php @@ -64,9 +64,9 @@ /** * @dataProvider providerBoolean - * @covers ::isModeratableEntity + * @covers ::isModeratedEntity */ - public function testIsModeratableEntity($status) { + public function testIsModeratedEntity($status) { $moderation_information = new ModerationInformation($this->setupModerationEntityManager($status), $this->getUser()); $entity_type = new ContentEntityType([ @@ -77,13 +77,13 @@ $entity->getEntityType()->willReturn($entity_type); $entity->bundle()->willReturn('test_bundle'); - $this->assertEquals($status, $moderation_information->isModeratableEntity($entity->reveal())); + $this->assertEquals($status, $moderation_information->isModeratedEntity($entity->reveal())); } /** - * @covers ::isModeratableEntity + * @covers ::isModeratedEntity */ - public function testIsModeratableEntityForNonBundleEntityType() { + public function testIsModeratedEntityForNonBundleEntityType() { $entity_type = new ContentEntityType([ 'id' => 'test_entity_type', ]); @@ -95,14 +95,14 @@ $entity_type_manager = $this->getEntityTypeManager($entity_storage->reveal()); $moderation_information = new ModerationInformation($entity_type_manager, $this->getUser()); - $this->assertEquals(FALSE, $moderation_information->isModeratableEntity($entity->reveal())); + $this->assertEquals(FALSE, $moderation_information->isModeratedEntity($entity->reveal())); } /** * @dataProvider providerBoolean - * @covers ::isModeratableBundle + * @covers ::isModeratedBundle */ - public function testIsModeratableBundle($status) { + public function testIsModeratedBundle($status) { $entity_type = new ContentEntityType([ 'id' => 'test_entity_type', 'bundle_entity_type' => 'entity_test_bundle', @@ -110,7 +110,7 @@ $moderation_information = new ModerationInformation($this->setupModerationEntityManager($status), $this->getUser()); - $this->assertEquals($status, $moderation_information->isModeratableBundle($entity_type, 'test_bundle')); + $this->assertEquals($status, $moderation_information->isModeratedBundle($entity_type, 'test_bundle')); } /**