Unverified Commit b7199c7d authored by larowlan's avatar larowlan Committed by larowlan

Issue #3042757 by larowlan, joy29, Tolyan4ik, agentrickard, Sam152, mcdwayne,...

Issue #3042757 by larowlan, joy29, Tolyan4ik, agentrickard, Sam152, mcdwayne, munish.kumar, stevector: Drupal 9 Deprecated Code Report
parent fb6e22db
......@@ -52,7 +52,6 @@ block_content.type.*.third_party.workbench_moderation:
views.filter.latest_revision:
type: views_filter
label: 'Latest revision'
type: mapping
mapping:
value:
type: string
......
<?php
/**
* @file
* Contains Drupal\workbench_moderation\Entity\Handler\GenericCustomizations.
*/
namespace Drupal\workbench_moderation\Entity\Handler;
use Drupal\Core\Config\Entity\ConfigEntityInterface;
use Drupal\Core\Entity\ContentEntityInterface;
use Drupal\Core\Entity\EntityHandlerInterface;
use Drupal\Core\Entity\EntityPublishedInterface;
use Drupal\Core\Entity\EntityTypeInterface;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\StringTranslation\StringTranslationTrait;
......@@ -35,10 +31,20 @@ class ModerationHandler implements ModerationHandlerInterface, EntityHandlerInte
* {@inheritdoc}
*/
public function onPresave(ContentEntityInterface $entity, $default_revision, $published_state) {
// This is *probably* not necessary if configuration is setup correctly,
// but it can't hurt.
$entity->setNewRevision(TRUE);
$entity->isDefaultRevision($default_revision);
// When entities are syncing, content moderation should not force a new
// revision to be created and should not update the default status of a
// revision. This is useful if changes are being made to entities or
// revisions which are not part of editorial updates triggered by normal
// content changes.
if (!$entity->isSyncing()) {
$entity->setNewRevision(TRUE);
$entity->isDefaultRevision($default_revision);
}
// Update publishing status if it can be updated and if it needs updating.
if (($entity instanceof EntityPublishedInterface) && $entity->isPublished() !== $published_state) {
$published_state ? $entity->setPublished() : $entity->setUnpublished();
}
}
/**
......
......@@ -15,18 +15,6 @@ use Drupal\node\Entity\Node;
*/
class NodeModerationHandler extends ModerationHandler {
/**
* {@inheritdoc}
*/
public function onPresave(ContentEntityInterface $entity, $default_revision, $published_state) {
if ($this->shouldModerate($entity)) {
parent::onPresave($entity, $default_revision, $published_state);
// Only nodes have a concept of published.
/** @var $entity Node */
$entity->setPublished($published_state);
}
}
/**
* {@inheritdoc}
*/
......@@ -50,19 +38,4 @@ class NodeModerationHandler extends ModerationHandler {
}
}
/**
* Check if an entity's default revision and/or state needs adjusting.
*
* @param \Drupal\Core\Entity\ContentEntityInterface $entity
*
* @return bool
* TRUE when either the default revision or the state needs to be updated.
*/
protected function shouldModerate(ContentEntityInterface $entity) {
// First condition is needed so you can add a translation.
// Second condition is needed when you want to publish a translation.
// Third condition is needed when you want to create a new draft for a published translation.
return $entity->isDefaultTranslation() || $entity->moderation_state->entity->isPublishedState() || $entity->isPublished();
}
}
......@@ -30,6 +30,12 @@ use Drupal\workbench_moderation\ModerationStateInterface;
* "edit-form" = "/admin/structure/moderation-state/states/{moderation_state}/edit",
* "delete-form" = "/admin/structure/moderation-state/states/{moderation_state}/delete",
* "collection" = "/admin/structure/moderation-state/states"
* },
* config_export = {
* "id",
* "label",
* "published",
* "default_revision",
* }
* )
*/
......
......@@ -32,6 +32,13 @@ use Drupal\workbench_moderation\ModerationStateTransitionInterface;
* "edit-form" = "/admin/structure/moderation-state/transitions/{moderation_state_transition}/edit",
* "delete-form" = "/admin/structure/moderation-state/transitions/{moderation_state_transition}/delete",
* "collection" = "/admin/structure/moderation-state/transitions"
* },
* config_export = {
* "id",
* "label",
* "stateFrom",
* "stateTo",
* "weight",
* }
* )
*/
......
......@@ -272,7 +272,7 @@ class EntityTypeInfo {
// @todo write a test for this.
->setDisplayOptions('view', [
'label' => 'hidden',
'type' => 'hidden',
'region' => 'hidden',
'weight' => -5,
])
// @todo write a custom widget/selection handler plugin instead of
......
......@@ -186,6 +186,6 @@ class BundleModerationConfigurationForm extends EntityForm {
parent::submitForm( $form, $form_state);
drupal_set_message($this->t('Your settings have been saved.'));
$this->messenger()->addMessage($this->t('Your settings have been saved.'));
}
}
......@@ -146,7 +146,7 @@ class EntityModerationForm extends FormBase {
$entity->save();
drupal_set_message($this->t('The moderation state has been updated.'));
$this->messenger()->addMessage($this->t('The moderation state has been updated.'));
/** @var ModerationState $state */
$state = $this->entityTypeManager->getStorage('moderation_state')->load($new_state);
......
......@@ -37,7 +37,7 @@ class ModerationStateDeleteForm extends EntityConfirmFormBase {
public function submitForm(array &$form, FormStateInterface $form_state) {
$this->entity->delete();
drupal_set_message(
$this->messenger()->addMessage(
$this->t('Moderation state %label deleted.',
[
'%label' => $this->entity->label()
......
......@@ -69,13 +69,13 @@ class ModerationStateForm extends EntityForm {
switch ($status) {
case SAVED_NEW:
drupal_set_message($this->t('Created the %label Moderation state.', [
$this->messenger()->addMessage($this->t('Created the %label Moderation state.', [
'%label' => $moderation_state->label(),
]));
break;
default:
drupal_set_message($this->t('Saved the %label Moderation state.', [
$this->messenger()->addMessage($this->t('Saved the %label Moderation state.', [
'%label' => $moderation_state->label(),
]));
}
......
......@@ -37,7 +37,7 @@ class ModerationStateTransitionDeleteForm extends EntityConfirmFormBase {
public function submitForm(array &$form, FormStateInterface $form_state) {
$this->entity->delete();
drupal_set_message(
$this->messenger()->addMessage(
$this->t('Moderation transition %label deleted.',
[
'%label' => $this->entity->label()
......
......@@ -4,7 +4,6 @@ namespace Drupal\workbench_moderation\Form;
use Drupal\Core\Entity\EntityForm;
use Drupal\Core\Entity\EntityTypeManagerInterface;
use Drupal\Core\Entity\Query\QueryFactory;
use Drupal\Core\Form\FormStateInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
......@@ -20,26 +19,20 @@ class ModerationStateTransitionForm extends EntityForm {
*/
protected $entityTypeManager;
/**
* @var \Drupal\Core\Entity\Query\QueryFactory
*/
protected $queryFactory;
/**
* Constructs a new ModerationStateTransitionForm.
*
* @param \Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager
*/
public function __construct(EntityTypeManagerInterface $entity_type_manager, QueryFactory $query_factory) {
public function __construct(EntityTypeManagerInterface $entity_type_manager) {
$this->entityTypeManager = $entity_type_manager;
$this->queryFactory = $query_factory;
}
/**
* {@inheritdoc}
*/
public static function create(ContainerInterface $container) {
return new static($container->get('entity_type.manager'), $container->get('entity.query'));
return new static($container->get('entity_type.manager'));
}
/**
......@@ -101,7 +94,7 @@ class ModerationStateTransitionForm extends EntityForm {
// Make sure there's always at least a wide enough delta on weight to cover
// the current value or the total number of transitions. That way we
// never end up forcing a transition to change its weight needlessly.
$num_transitions = $this->queryFactory->get('moderation_state_transition')->count()->execute();
$num_transitions = $this->entityTypeManager->getStorage('moderation_state_transition')->getQuery()->count()->execute();
$delta = max(abs($moderation_state_transition->getWeight()), $num_transitions);
$form['weight'] = [
......@@ -125,13 +118,13 @@ class ModerationStateTransitionForm extends EntityForm {
switch ($status) {
case SAVED_NEW:
drupal_set_message($this->t('Created the %label Moderation state transition.', [
$this->messenger()->addMessage($this->t('Created the %label Moderation state transition.', [
'%label' => $moderation_state_transition->label(),
]));
break;
default:
drupal_set_message($this->t('Saved the %label Moderation state transition.', [
$this->messenger()->addMessage($this->t('Saved the %label Moderation state transition.', [
'%label' => $moderation_state_transition->label(),
]));
}
......
......@@ -24,8 +24,8 @@ class ModerationStateTransitionListBuilder extends DraggableListBuilder {
public static function createInstance(ContainerInterface $container, EntityTypeInterface $entity_type) {
return new static(
$entity_type,
$container->get('entity.manager')->getStorage($entity_type->id()),
$container->get('entity.manager')->getStorage('moderation_state')
$container->get('entity_type.manager')->getStorage($entity_type->id()),
$container->get('entity_type.manager')->getStorage('moderation_state')
);
}
......
......@@ -4,6 +4,7 @@ namespace Drupal\workbench_moderation;
use Drupal\Component\Uuid\UuidInterface;
use Drupal\Core\Cache\MemoryCache\MemoryCacheInterface;
use Drupal\Core\Config\ConfigFactoryInterface;
use Drupal\Core\Config\Entity\ConfigEntityStorage;
use Drupal\Core\Entity\EntityHandlerInterface;
......@@ -30,15 +31,16 @@ class ModerationStateTransitionStorage extends ConfigEntityStorage implements En
$container->get('config.factory'),
$container->get('uuid'),
$container->get('language_manager'),
$container->get('entity_type.manager')
$container->get('entity_type.manager'),
$container->get('entity.memory_cache')
);
}
/**
* {@inheritdoc}
*/
public function __construct(EntityTypeInterface $entity_type, ConfigFactoryInterface $config_factory, UuidInterface $uuid_service, LanguageManagerInterface $language_manager, EntityTypeManagerInterface $entity_type_manager) {
parent::__construct($entity_type, $config_factory, $uuid_service, $language_manager);
public function __construct(EntityTypeInterface $entity_type, ConfigFactoryInterface $config_factory, UuidInterface $uuid_service, LanguageManagerInterface $language_manager, EntityTypeManagerInterface $entity_type_manager, MemoryCacheInterface $memory_cache) {
parent::__construct($entity_type, $config_factory, $uuid_service, $language_manager, $memory_cache);
$this->entityTypeManager = $entity_type_manager;
}
......
......@@ -3,6 +3,7 @@
namespace Drupal\workbench_moderation\ParamConverter;
use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Entity\EntityRepositoryInterface;
use Drupal\Core\ParamConverter\EntityConverter;
use Drupal\Core\TypedData\TranslatableInterface;
use Drupal\workbench_moderation\ModerationInformationInterface;
......@@ -22,16 +23,15 @@ class EntityRevisionConverter extends EntityConverter {
/**
* EntityRevisionConverter constructor.
*
* @todo: If the parent class is ever cleaned up to use EntityTypeManager
* instead of Entity manager, this method will also need to be adjusted.
*
* @param \Drupal\Core\Entity\EntityManagerInterface $entity_type_manager
* @param \Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager
* The entity manager, needed by the parent class.
* @param \Drupal\workbench_moderation\ModerationInformationInterface $moderation_info
* The moderation info utility service.
* @param \Drupal\Core\Entity\EntityRepositoryInterface $entity_repository
* Entity repository.
*/
public function __construct(EntityTypeManagerInterface $entity_type_manager, ModerationInformationInterface $moderation_info) {
parent::__construct($entity_type_manager);
public function __construct(EntityTypeManagerInterface $entity_type_manager, ModerationInformationInterface $moderation_info, EntityRepositoryInterface $entity_repository) {
parent::__construct($entity_type_manager, $entity_repository);
$this->moderationInformation = $moderation_info;
}
......@@ -71,11 +71,11 @@ class EntityRevisionConverter extends EntityConverter {
if ($default = $route->getDefault('_entity_form') ) {
// If no operation is provided, use 'default'.
$default .= '.default';
list($entity_type_id, $operation) = explode('.', $default);
if (!$this->entityManager->hasDefinition($entity_type_id)) {
[$entity_type_id, $operation] = explode('.', $default);
if (!$this->entityTypeManager->hasDefinition($entity_type_id)) {
return FALSE;
}
$entity_type = $this->entityManager->getDefinition($entity_type_id);
$entity_type = $this->entityTypeManager->getDefinition($entity_type_id);
return $operation == 'edit' && $entity_type && $entity_type->isRevisionable();
}
}
......@@ -93,7 +93,7 @@ class EntityRevisionConverter extends EntityConverter {
// If the entity type is translatable, ensure we return the proper
// translation object for the current context.
if ($entity instanceof EntityInterface && $entity instanceof TranslatableInterface) {
$entity = $this->entityManager->getTranslationFromContext($entity, NULL, array('operation' => 'entity_upcast'));
$entity = $this->entityRepository->getTranslationFromContext($entity, NULL, array('operation' => 'entity_upcast'));
}
}
......
......@@ -2,7 +2,6 @@
namespace Drupal\workbench_moderation;
use Drupal\Core\Routing\UrlGeneratorTrait;
use Drupal\Core\StringTranslation\StringTranslationTrait;
use Drupal\workbench_moderation\Entity\ModerationState;
use Drupal\workbench_moderation\Entity\ModerationStateTransition;
......@@ -13,7 +12,6 @@ use Drupal\workbench_moderation\Entity\ModerationStateTransition;
class Permissions {
use StringTranslationTrait;
use UrlGeneratorTrait;
/**
* Returns an array of transition permissions.
......
......@@ -3,19 +3,19 @@
namespace Drupal\workbench_moderation\Plugin\Action;
use Drupal\Core\Access\AccessResult;
use Drupal\Core\Action\Plugin\Action\PublishAction;
use Drupal\Core\Entity\EntityTypeManagerInterface;
use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
use Drupal\Core\Session\AccountInterface;
use Drupal\node\Plugin\Action\PublishNode;
use Drupal\workbench_moderation\ModerationInformationInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
/**
* Alternate action plugin that knows to opt-out of modifying moderated entites.
*
* @see PublishNode
* @see PublishAction
*/
class ModerationOptOutPublishNode extends PublishNode implements ContainerFactoryPluginInterface {
class ModerationOptOutPublishNode extends PublishAction implements ContainerFactoryPluginInterface {
/**
* @var \Drupal\workbench_moderation\ModerationInformationInterface
......@@ -43,7 +43,7 @@ class ModerationOptOutPublishNode extends PublishNode implements ContainerFactor
*/
public function execute($entity = NULL) {
if ($entity && $this->moderationInfo->isModeratableEntity($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.'));
$this->messenger()->addMessage($this->t('One or more entities were skipped as they are under moderation and may not be directly published or unpublished.'));
return;
}
......
......@@ -3,19 +3,19 @@
namespace Drupal\workbench_moderation\Plugin\Action;
use Drupal\Core\Access\AccessResult;
use Drupal\Core\Action\Plugin\Action\UnpublishAction;
use Drupal\Core\Entity\EntityTypeManagerInterface;
use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
use Drupal\Core\Session\AccountInterface;
use Drupal\node\Plugin\Action\UnpublishNode;
use Drupal\workbench_moderation\ModerationInformationInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
/**
* Alternate action plugin that knows to opt-out of modifying moderated entites.
*
* @see UnpublishNode
* @see UnpublishAction
*/
class ModerationOptOutUnpublishNode extends UnpublishNode implements ContainerFactoryPluginInterface {
class ModerationOptOutUnpublishNode extends UnpublishAction implements ContainerFactoryPluginInterface {
/**
* @var \Drupal\workbench_moderation\ModerationInformationInterface
......@@ -43,7 +43,7 @@ class ModerationOptOutUnpublishNode extends UnpublishNode implements ContainerFa
*/
public function execute($entity = NULL) {
if ($entity && $this->moderationInfo->isModeratableEntity($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.'));
$this->messenger()->addMessage($this->t('One or more entities were skipped as they are under moderation and may not be directly published or unpublished.'));
return;
}
......
......@@ -93,12 +93,10 @@ class ModerationStateWidget extends OptionsSelectWidget implements ContainerFact
* 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 transation entity query 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) {
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, ModerationInformation $moderation_information, StateTransitionValidation $validator) {
parent::__construct($plugin_id, $plugin_definition, $field_definition, $settings, $third_party_settings);
$this->moderationStateTransitionEntityQuery = $entity_query;
$this->moderationStateTransitionEntityQuery = $entity_type_manager->getStorage('moderation_state_transition')->getQuery();
$this->moderationStateTransitionStorage = $moderation_state_transition_storage;
$this->moderationStateStorage = $moderation_state_storage;
$this->entityTypeManager = $entity_type_manager;
......@@ -121,7 +119,6 @@ class ModerationStateWidget extends OptionsSelectWidget implements ContainerFact
$container->get('entity_type.manager'),
$container->get('entity_type.manager')->getStorage('moderation_state'),
$container->get('entity_type.manager')->getStorage('moderation_state_transition'),
$container->get('entity.query')->get('moderation_state_transition', 'AND'),
$container->get('workbench_moderation.moderation_information'),
$container->get('workbench_moderation.state_transition_validation')
);
......
......@@ -107,7 +107,7 @@ class EntityModerationRouteProvider implements EntityRouteProviderInterface, Ent
* type does not support fields.
*/
protected function getEntityTypeIdKeyType(EntityTypeInterface $entity_type) {
if (!$entity_type->isSubclassOf(FieldableEntityInterface::class)) {
if (!$entity_type->entityClassImplements(FieldableEntityInterface::class)) {
return NULL;
}
......
......@@ -4,7 +4,6 @@ namespace Drupal\workbench_moderation;
use Drupal\Core\Entity\ContentEntityInterface;
use Drupal\Core\Entity\EntityTypeManagerInterface;
use Drupal\Core\Entity\Query\QueryFactory;
use Drupal\Core\Session\AccountInterface;
use Drupal\workbench_moderation\Entity\ModerationState;
use Drupal\workbench_moderation\Entity\ModerationStateTransition;
......@@ -19,11 +18,6 @@ class StateTransitionValidation {
*/
protected $entityTypeManager;
/**
* @var \Drupal\Core\Entity\Query\QueryFactory
*/
protected $queryFactory;
/**
* Stores the possible state transitions.
*
......@@ -36,12 +30,9 @@ class StateTransitionValidation {
*
* @param \Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager
* The entity type manager service.
* @param \Drupal\Core\Entity\Query\QueryFactory $query_factory
* The entity query factory.
*/
public function __construct(EntityTypeManagerInterface $entity_type_manager, QueryFactory $query_factory) {
public function __construct(EntityTypeManagerInterface $entity_type_manager) {
$this->entityTypeManager = $entity_type_manager;
$this->queryFactory = $query_factory;
}
/**
......@@ -243,7 +234,7 @@ class StateTransitionValidation {
* A transition state query.
*/
protected function transitionStateQuery() {
return $this->queryFactory->get('moderation_state_transition', 'AND');
return $this->entityTypeManager->getStorage('moderation_state_transition')->getQuery('AND');;
}
/**
......
......@@ -3,6 +3,6 @@ type: module
description: 'Provides default views for views Workbench moderation tests.'
package: Testing
version: VERSION
core: 8.x
core_version_requirement: ^8.8 || ^9
dependencies:
- workbench_moderation
......@@ -16,6 +16,11 @@ use Drupal\Tests\BrowserTestBase;
*/
class LatestRevisionViewsFilterTest extends BrowserTestBase {
/**
* {@inheritdoc}
*/
protected $defaultTheme = 'stark';
/**
* {@inheritdoc}
*/
......
......@@ -15,6 +15,11 @@ class ModerationFormAccessTest extends BrowserTestBase {
use WorkbenchModerationTestTrait;
/**
* {@inheritdoc}
*/
protected $defaultTheme = 'stark';
/**
* {@inheritdoc}
*/
......
......@@ -50,13 +50,13 @@ class ModerationFormTest extends ModerationStateTestBase {
// The canonical view should have a moderation form, because it is not the
// live revision.
$this->drupalGet($canonical_path);
$this->assertResponse(200);
$this->assertSession()->statusCodeEquals(200);
$this->assertField('edit-new-state', 'The node view page has a moderation form.');
// The latest version page should not show, because there is no forward
// revision.
$this->drupalGet($latest_version_path);
$this->assertResponse(403);
$this->assertSession()->statusCodeEquals(403);
// Update the draft.
$this->drupalPostForm($edit_path, [
......@@ -66,13 +66,13 @@ class ModerationFormTest extends ModerationStateTestBase {
// The canonical view should have a moderation form, because it is not the
// live revision.
$this->drupalGet($canonical_path);
$this->assertResponse(200);
$this->assertSession()->statusCodeEquals(200);
$this->assertField('edit-new-state', 'The node view page has a moderation form.');
// The latest version page should not show, because there is still no
// forward revision.
$this->drupalGet($latest_version_path);
$this->assertResponse(403);
$this->assertSession()->statusCodeEquals(403);
// Publish the draft.
$this->drupalPostForm($edit_path, [
......@@ -82,13 +82,13 @@ class ModerationFormTest extends ModerationStateTestBase {
// The published view should not have a moderation form, because it is the
// live revision.
$this->drupalGet($canonical_path);
$this->assertResponse(200);
$this->assertSession()->statusCodeEquals(200);
$this->assertNoField('edit-new-state', 'The node view page has no moderation form.');
// The latest version page should not show, because there is still no
// forward revision.
$this->drupalGet($latest_version_path);
$this->assertResponse(403);
$this->assertSession()->statusCodeEquals(403);
// Make a forward revision.
$this->drupalPostForm($edit_path, [
......@@ -98,15 +98,15 @@ class ModerationFormTest extends ModerationStateTestBase {
// The published view should not have a moderation form, because it is the
// live revision.
$this->drupalGet($canonical_path);
$this->assertResponse(200);
$this->assertSession()->statusCodeEquals(200);
$this->assertNoField('edit-new-state', 'The node view page has no moderation form.');
// The latest version page should show the moderation form and have "Draft"
// status, because the forward revision is in "Draft".
$this->drupalGet($latest_version_path);
$this->assertResponse(200);
$this->assertSession()->statusCodeEquals(200);
$this->assertField('edit-new-state', 'The latest-version page has a moderation form.');
$this->assertText('Draft', 'Correct status found on the latest-version page.');
$this->assertSession()->pageTextContains('Draft', 'Correct status found on the latest-version page.');
// Submit the moderation form to change status to needs review.
$this->drupalPostForm($latest_version_path, [
......@@ -116,9 +116,9 @@ class ModerationFormTest extends ModerationStateTestBase {
// The latest version page should show the moderation form and have "Needs
// Review" status, because the forward revision is in "Needs Review".
$this->drupalGet($latest_version_path);
$this->assertResponse(200);
$this->assertSession()->statusCodeEquals(200);
$this->assertField('edit-new-state', 'The latest-version page has a moderation form.');
$this->assertText('Needs Review', 'Correct status found on the latest-version page.');
$this->assertSession()->pageTextContains('Needs Review', 'Correct status found on the latest-version page.');
}
/**
......@@ -139,7 +139,7 @@ class ModerationFormTest extends ModerationStateTestBase {
], t('Apply'));
$this->drupalGet(sprintf('node/%d/revisions', $node->id()));
$this->assertText('by ' . $another_user->getAccountName());
$this->assertSession()->pageTextContains('by ' . $another_user->getAccountName());
}
}
......@@ -47,7 +47,7 @@ class ModerationLocaleTest extends ModerationStateTestBase {
'langcode[0][value]' => 'en',
];
$this->drupalPostForm('node/add/article', $edit, t('Save and Publish'));
$this->assertText(t('Article Published English node has been created.'));
$this->assertSession()->pageTextContains(t('Article Published English node has been created.'));
$english_node = $this->drupalGetNodeByTitle('Published English node');
// Add a French translation.
......@@ -60,7 +60,7 @@ class ModerationLocaleTest extends ModerationStateTestBase {
// Here the error has occured "The website encountered an unexpected error.
// Please try again later."