Commit aee577b8 authored by larowlan's avatar larowlan

Issue #2890364 by timmillwood, amateescu, plach, xjm: Replace all uses of...

Issue #2890364 by timmillwood, amateescu, plach, xjm: Replace all uses of "forward revision" with "pending revision"
parent 13e93c04
......@@ -5,7 +5,7 @@
use Symfony\Component\Validator\Constraint;
/**
* Validation constraint for changing the book outline in forward revisions.
* Validation constraint for changing the book outline in pending revisions.
*
* @Constraint(
* id = "BookOutline",
......
......@@ -9,7 +9,7 @@
use Symfony\Component\Validator\ConstraintValidator;
/**
* Constraint validator for changing the book outline in forward revisions.
* Constraint validator for changing the book outline in pending revisions.
*/
class BookOutlineConstraintValidator extends ConstraintValidator implements ContainerInjectionInterface {
......
......@@ -41,7 +41,7 @@ protected function setUp() {
/**
* Tests that book drafts can not modify the book outline.
*/
public function testBookWithForwardRevisions() {
public function testBookWithPendingRevisions() {
// Create two books.
$book_1_nodes = $this->createBook(t('Save and Publish'));
$book_1 = $this->book;
......
......@@ -7,11 +7,11 @@
use Drupal\KernelTests\KernelTestBase;
/**
* Tests that the Book module handles forward revisions correctly.
* Tests that the Book module handles pending revisions correctly.
*
* @group book
*/
class BookForwardRevisionTest extends KernelTestBase {
class BookPendingRevisionTest extends KernelTestBase {
/**
* Modules to enable.
......@@ -34,9 +34,9 @@ protected function setUp() {
}
/**
* Tests forward revision handling for books.
* Tests pending revision handling for books.
*/
public function testBookWithForwardRevisions() {
public function testBookWithPendingRevisions() {
$content_type = NodeType::create([
'type' => $this->randomMachineName(),
'name' => $this->randomString(),
......@@ -65,36 +65,36 @@ public function testBookWithForwardRevisions() {
$child->book['pid'] = $book_1->id();
$child->save();
// Try to move the child to a different book while saving it as a forward
// Try to move the child to a different book while saving it as a pending
// revision.
/** @var \Drupal\book\BookManagerInterface $book_manager */
$book_manager = $this->container->get('book.manager');
// Check that the API doesn't allow us to change the book outline for
// forward revisions.
// pending revisions.
$child->book['bid'] = $book_2->id();
$child->setNewRevision(TRUE);
$child->isDefaultRevision(FALSE);
$this->assertFalse($book_manager->updateOutline($child), 'A forward revision can not change the book outline.');
$this->assertFalse($book_manager->updateOutline($child), 'A pending revision can not change the book outline.');
// Check that the API doesn't allow us to change the book parent for
// forward revisions.
// pending revisions.
$child = \Drupal::entityTypeManager()->getStorage('node')->loadUnchanged($child->id());
$child->book['pid'] = $book_1_child->id();
$child->setNewRevision(TRUE);
$child->isDefaultRevision(FALSE);
$this->assertFalse($book_manager->updateOutline($child), 'A forward revision can not change the book outline.');
$this->assertFalse($book_manager->updateOutline($child), 'A pending revision can not change the book outline.');
// Check that the API doesn't allow us to change the book weight for
// forward revisions.
// pending revisions.
$child = \Drupal::entityTypeManager()->getStorage('node')->loadUnchanged($child->id());
$child->book['weight'] = 2;
$child->setNewRevision(TRUE);
$child->isDefaultRevision(FALSE);
$this->assertFalse($book_manager->updateOutline($child), 'A forward revision can not change the book outline.');
$this->assertFalse($book_manager->updateOutline($child), 'A pending revision can not change the book outline.');
}
}
......@@ -34,7 +34,7 @@ public function __construct(ModerationInformationInterface $moderation_informati
}
/**
* Checks that there is a forward revision available.
* Checks that there is a pending revision available.
*
* This checker assumes the presence of an '_entity_access' requirement key
* in the same form as used by EntityAccessCheck.
......@@ -54,7 +54,7 @@ public function __construct(ModerationInformationInterface $moderation_informati
public function access(Route $route, RouteMatchInterface $route_match, AccountInterface $account) {
// This tab should not show up unless there's a reason to show it.
$entity = $this->loadEntity($route, $route_match);
if ($this->moderationInfo->hasForwardRevision($entity)) {
if ($this->moderationInfo->hasPendingRevision($entity)) {
// Check the global permissions first.
$access_result = AccessResult::allowedIfHasPermissions($account, ['view latest version', 'view any unpublished content']);
if (!$access_result->isAllowed()) {
......
......@@ -242,8 +242,8 @@ public function entityView(array &$build, EntityInterface $entity, EntityViewDis
// Don't display the moderation form when when:
// - The revision is not translation affected.
// - There are more than one translation languages.
// - The entity has forward revisions.
if (!$this->moderationInfo->isForwardRevisionAllowed($entity)) {
// - The entity has pending revisions.
if (!$this->moderationInfo->isPendingRevisionAllowed($entity)) {
return;
}
......
......@@ -300,7 +300,7 @@ public function formAlter(array &$form, FormStateInterface $form_state, $form_id
->getHandler($entity->getEntityTypeId(), 'moderation')
->enforceRevisionsEntityFormAlter($form, $form_state, $form_id);
if (!$this->moderationInfo->isForwardRevisionAllowed($entity)) {
if (!$this->moderationInfo->isPendingRevisionAllowed($entity)) {
$latest_revision = $this->moderationInfo->getLatestRevision($entity->getEntityTypeId(), $entity->id());
if ($entity->bundle()) {
$bundle_type_id = $entity->getEntityType()->getBundleEntityType();
......@@ -318,8 +318,8 @@ public function formAlter(array &$form, FormStateInterface $form_state, $form_id
'@latest_revision_delete_url' => $translation->toUrl('delete-form', ['language' => $translation->language()])->toString(),
];
$label = $this->t('Unable to save this @type_label.', $args);
$message = $this->t('<a href="@latest_revision_edit_url">Publish</a> or <a href="@latest_revision_delete_url">delete</a> the latest draft revision to allow all workflow transitions.', $args);
$full_message = $this->t('Unable to save this @type_label. <a href="@latest_revision_edit_url">Publish</a> or <a href="@latest_revision_delete_url">delete</a> the latest draft revision to allow all workflow transitions.', $args);
$message = $this->t('<a href="@latest_revision_edit_url">Publish</a> or <a href="@latest_revision_delete_url">delete</a> the latest revision to allow all workflow transitions.', $args);
$full_message = $this->t('Unable to save this @type_label. <a href="@latest_revision_edit_url">Publish</a> or <a href="@latest_revision_delete_url">delete</a> the latest revision to allow all workflow transitions.', $args);
drupal_set_message($full_message, 'error');
$form['actions']['#access'] = FALSE;
......@@ -351,7 +351,7 @@ public function formAlter(array &$form, FormStateInterface $form_state, $form_id
}
/**
* Redirect content entity edit forms on save, if there is a forward revision.
* Redirect content entity edit forms on save, if there is a pending revision.
*
* When saving their changes, editors should see those changes displayed on
* the next page.
......@@ -366,7 +366,7 @@ public static function bundleFormRedirect(array &$form, FormStateInterface $form
$entity = $form_state->getFormObject()->getEntity();
$moderation_info = \Drupal::getContainer()->get('content_moderation.moderation_information');
if ($moderation_info->hasForwardRevision($entity) && $entity->hasLinkTemplate('latest-version')) {
if ($moderation_info->hasPendingRevision($entity) && $entity->hasLinkTemplate('latest-version')) {
$entity_type_id = $entity->getEntityTypeId();
$form_state->setRedirect("entity.$entity_type_id.latest_version", [$entity_type_id => $entity->id()]);
}
......
......@@ -140,7 +140,7 @@ public function submitForm(array &$form, FormStateInterface $form_state) {
$new_state = $this->moderationInfo->getWorkflowForEntity($entity)->getTypePlugin()->getState($new_state);
// The page we're on likely won't be visible if we just set the entity to
// the default state, as we hide that latest-revision tab if there is no
// forward revision. Redirect to the canonical URL instead, since that will
// pending revision. Redirect to the canonical URL instead, since that will
// still exist.
if ($new_state->isDefaultRevisionState()) {
$form_state->setRedirectUrl($entity->toUrl('canonical'));
......
......@@ -127,8 +127,8 @@ public function getAffectedRevisionTranslation(ContentEntityInterface $entity) {
/**
* {@inheritdoc}
*/
public function isForwardRevisionAllowed(ContentEntityInterface $entity) {
return !(!$entity->isRevisionTranslationAffected() && count($entity->getTranslationLanguages()) > 1 && $this->hasForwardRevision($entity));
public function isPendingRevisionAllowed(ContentEntityInterface $entity) {
return !(!$entity->isRevisionTranslationAffected() && count($entity->getTranslationLanguages()) > 1 && $this->hasPendingRevision($entity));
}
/**
......@@ -141,7 +141,7 @@ public function isLatestRevision(ContentEntityInterface $entity) {
/**
* {@inheritdoc}
*/
public function hasForwardRevision(ContentEntityInterface $entity) {
public function hasPendingRevision(ContentEntityInterface $entity) {
return $this->isModeratedEntity($entity)
&& !($this->getLatestRevisionId($entity->getEntityTypeId(), $entity->id()) == $this->getDefaultRevisionId($entity->getEntityTypeId(), $entity->id()));
}
......
......@@ -101,7 +101,7 @@ public function getDefaultRevisionId($entity_type_id, $entity_id);
public function getAffectedRevisionTranslation(ContentEntityInterface $entity);
/**
* Determines if forward revisions are allowed.
* Determines if pending revisions are allowed.
*
* @internal
*
......@@ -109,9 +109,9 @@ public function getAffectedRevisionTranslation(ContentEntityInterface $entity);
* The content entity.
*
* @return bool
* If forward revisions are allowed.
* If pending revisions are allowed.
*/
public function isForwardRevisionAllowed(ContentEntityInterface $entity);
public function isPendingRevisionAllowed(ContentEntityInterface $entity);
/**
* Determines if an entity is a latest revision.
......@@ -126,15 +126,15 @@ public function isForwardRevisionAllowed(ContentEntityInterface $entity);
public function isLatestRevision(ContentEntityInterface $entity);
/**
* Determines if a forward revision exists for the specified entity.
* Determines if a pending revision exists for the specified entity.
*
* @param \Drupal\Core\Entity\ContentEntityInterface $entity
* The entity which may or may not have a forward revision.
* The entity which may or may not have a pending revision.
*
* @return bool
* TRUE if this entity has forward revisions available, FALSE otherwise.
* TRUE if this entity has pending revisions available, FALSE otherwise.
*/
public function hasForwardRevision(ContentEntityInterface $entity);
public function hasPendingRevision(ContentEntityInterface $entity);
/**
* Determines if an entity is "live".
......
......@@ -41,23 +41,23 @@ public function __construct(EntityManagerInterface $entity_manager, ModerationIn
* {@inheritdoc}
*/
public function applies($definition, $name, Route $route) {
return $this->hasForwardRevisionFlag($definition) || $this->isEditFormPage($route);
return $this->hasPendingRevisionFlag($definition) || $this->isEditFormPage($route);
}
/**
* Determines if the route definition includes a forward-revision flag.
* Determines if the route definition includes a pending revision flag.
*
* This is a custom flag defined by the Content Moderation module to load
* forward revisions rather than the default revision on a given route.
* pending revisions rather than the default revision on a given route.
*
* @param array $definition
* The parameter definition provided in the route options.
*
* @return bool
* TRUE if the forward revision flag is set, FALSE otherwise.
* TRUE if the pending revision flag is set, FALSE otherwise.
*/
protected function hasForwardRevisionFlag(array $definition) {
return (isset($definition['load_forward_revision']) && $definition['load_forward_revision']);
protected function hasPendingRevisionFlag(array $definition) {
return (isset($definition['load_pending_revision']) && $definition['load_pending_revision']);
}
/**
......
......@@ -88,7 +88,7 @@ protected function getLatestVersionRoute(EntityTypeInterface $entity_type) {
->setOption('parameters', [
$entity_type_id => [
'type' => 'entity:' . $entity_type_id,
'load_forward_revision' => 1,
'load_pending_revision' => 1,
],
]);
......
......@@ -93,18 +93,18 @@ public function testCustomBlockModeration() {
$this->drupalGet('');
$this->assertText($updated_body);
// Publish the block so we can create a forward revision.
// Publish the block so we can create a pending revision.
$this->drupalPostForm('block/' . $block->id(), [], t('Save and Publish'));
// Create a forward revision.
$forward_revision_body = 'This is the forward revision body value';
// Create a pending revision.
$pending_revision_body = 'This is the pending revision body value';
$edit = [
'body[0][value]' => $forward_revision_body,
'body[0][value]' => $pending_revision_body,
];
$this->drupalPostForm('block/' . $block->id(), $edit, t('Save and Create New Draft'));
$this->assertText(t('basic Moderated block has been updated.'));
// Navigate to home page and check that the forward revision doesn't show,
// Navigate to home page and check that the pending revision doesn't show,
// since it should not be set as the default revision.
$this->drupalGet('');
$this->assertText($updated_body);
......@@ -116,10 +116,10 @@ public function testCustomBlockModeration() {
$this->drupalPostForm('block/' . $block->id() . '/latest', $edit, t('Apply'));
$this->assertText(t('The moderation state has been updated.'));
// Navigate to home page and check that the forward revision is now the
// Navigate to home page and check that the pending revision is now the
// default revision and therefore visible.
$this->drupalGet('');
$this->assertText($forward_revision_body);
$this->assertText($pending_revision_body);
}
}
......@@ -105,7 +105,7 @@ public function testFormSaveDestination() {
$this->assertUrl(Url::fromRoute('entity.node.canonical', ['node' => $node->id()]));
$this->assertText('Third version of the content.');
// Make a new forward revision; after saving, we should be on the "Latest
// Make a new pending revision; after saving, we should be on the "Latest
// version" tab.
$this->drupalPostForm($edit_path, [
'body[0][value]' => 'Fourth version of the content.',
......
......@@ -116,7 +116,7 @@ public function testPageAccess() {
$this->drupalGet($view_path);
$this->assertResponse(200);
// Create a forward revision for the 'Latest revision' tab.
// Create a pending revision for the 'Latest revision' tab.
$this->drupalLogin($this->adminUser);
$this->drupalPostForm($edit_path, [
'title[0][value]' => 'moderated content revised',
......@@ -132,7 +132,7 @@ public function testPageAccess() {
$this->drupalGet($view_path);
$this->assertResponse(200);
// Now make another user, who should not be able to see forward revisions.
// Now make another user, who should not be able to see pending revisions.
$user = $this->createUser([
'use editorial transition create_new_draft',
]);
......
......@@ -55,9 +55,9 @@ protected function createNodeType() {
}
/**
* Verifies that the process of saving forward-revisions works as expected.
* Verifies that the process of saving pending revisions works as expected.
*/
public function testForwardRevisions() {
public function testPendingRevisions() {
// Create a new node in draft.
$page = Node::create([
'type' => 'page',
......@@ -68,7 +68,7 @@ public function testForwardRevisions() {
$id = $page->id();
// Verify the entity saved correctly, and that the presence of forward
// Verify the entity saved correctly, and that the presence of pending
// revisions doesn't affect the default node load.
/** @var Node $page */
$page = Node::load($id);
......@@ -87,7 +87,7 @@ public function testForwardRevisions() {
$this->assertTrue($page->isDefaultRevision());
$this->assertTrue($page->isPublished());
// Make a new forward-revision in Draft.
// Make a new pending revision in Draft.
$page->setTitle('C');
$page->moderation_state->value = 'draft';
$page->save();
......@@ -96,7 +96,7 @@ public function testForwardRevisions() {
$page = Node::load($id);
$this->assertEquals('B', $page->getTitle());
// Verify we can load the forward revision, even if the mechanism is kind
// Verify we can load the pending revision, even if the mechanism is kind
// of gross. Note: revisionIds() is only available on NodeStorageInterface,
// so this won't work for non-nodes. We'd need to use entity queries. This
// is a core bug that should get fixed.
......
......@@ -186,13 +186,13 @@ public function testInvalidStateMultilingual() {
$node_fr->save();
$this->assertEquals('published', $node_fr->moderation_state->value);
// Create a forward revision of the original node.
// Create a pending revision of the original node.
$node->moderation_state = 'draft';
$node->setNewRevision(TRUE);
$node->isDefaultRevision(FALSE);
$node->save();
// For the forward english revision, there should be a violation from draft
// For the pending english revision, there should be a violation from draft
// to archived.
$node->moderation_state = 'archived';
$violations = $node->validate();
......
......@@ -45,8 +45,8 @@ protected function setUp() {
* The class of the entity to mock.
* @param string $entity_type
* The machine name of the entity to mock.
* @param bool $has_forward
* Whether this entity should have a forward revision in the system.
* @param bool $has_pending_revision
* Whether this entity should have a pending revision in the system.
* @param array $account_permissions
* An array of permissions the account has.
* @param bool $is_owner
......@@ -57,7 +57,7 @@ protected function setUp() {
*
* @dataProvider accessSituationProvider
*/
public function testLatestAccessPermissions($entity_class, $entity_type, $has_forward, array $account_permissions, $is_owner, $result_class) {
public function testLatestAccessPermissions($entity_class, $entity_type, $has_pending_revision, array $account_permissions, $is_owner, $result_class) {
/** @var \Drupal\Core\Session\AccountInterface $account */
$account = $this->prophesize(AccountInterface::class);
......@@ -82,7 +82,7 @@ public function testLatestAccessPermissions($entity_class, $entity_type, $has_fo
/** @var \Drupal\content_moderation\ModerationInformation $mod_info */
$mod_info = $this->prophesize(ModerationInformation::class);
$mod_info->hasForwardRevision($entity->reveal())->willReturn($has_forward);
$mod_info->hasPendingRevision($entity->reveal())->willReturn($has_pending_revision);
$route = $this->prophesize(Route::class);
......@@ -119,13 +119,13 @@ public function accessSituationProvider() {
// Node with own content permissions and no latest version, but no perms
// to view latest version.
[Node::class, 'node', TRUE, ['view own unpublished content'], FALSE, AccessResultNeutral::class],
// Block with forward revision, and permissions to view any.
// Block with pending revision, and permissions to view any.
[BlockContent::class, 'block_content', TRUE, ['view latest version', 'view any unpublished content'], FALSE, AccessResultAllowed::class],
// Block with no forward revision.
// Block with no pending revision.
[BlockContent::class, 'block_content', FALSE, ['view latest version', 'view any unpublished content'], FALSE, AccessResultForbidden::class],
// Block with forward revision, but no permission to view any.
// Block with pending revision, but no permission to view any.
[BlockContent::class, 'block_content', TRUE, ['view latest version', 'view own unpublished content'], FALSE, AccessResultNeutral::class],
// Block with no forward revision.
// Block with no pending revision.
[BlockContent::class, 'block_content', FALSE, ['view latest version', 'view own unpublished content'], FALSE, AccessResultForbidden::class],
];
}
......
......@@ -5,7 +5,7 @@
use Symfony\Component\Validator\Constraint;
/**
* Validation constraint for changing the menu settings in forward revisions.
* Validation constraint for changing the menu settings in pending revisions.
*
* @Constraint(
* id = "MenuSettings",
......
......@@ -6,7 +6,7 @@
use Symfony\Component\Validator\ConstraintValidator;
/**
* Constraint validator for changing the menu settings in forward revisions.
* Constraint validator for changing the menu settings in pending revisions.
*/
class MenuSettingsConstraintValidator extends ConstraintValidator {
......@@ -25,15 +25,15 @@ public function validate($entity, Constraint $constraint) {
$values['parent'] = $parent;
}
// Handle the case when a menu link is added to a forward revision.
// Handle the case when a menu link is added to a pending revision.
if (!$defaults['entity_id'] && $values['enabled']) {
$violation_path = 'menu';
}
// Handle the case when the menu link is deleted in a forward revision.
// Handle the case when the menu link is deleted in a pending revision.
elseif (empty($values['enabled']) && $defaults['entity_id']) {
$violation_path = 'menu';
}
// Handle all the other menu link changes in a forward revision.
// Handle all the other menu link changes in a pending revision.
elseif ($defaults['entity_id']) {
if (($values['title'] != $defaults['title'])) {
$violation_path = 'menu.title';
......
......@@ -42,7 +42,7 @@ protected function setUp() {
/**
* Tests that node drafts can not modify the menu settings.
*/
public function testMenuUiWithForwardRevisions() {
public function testMenuUiWithPendingRevisions() {
$editor = $this->drupalCreateUser([
'administer nodes',
'administer menu',
......@@ -62,7 +62,7 @@ public function testMenuUiWithForwardRevisions() {
$this->drupalPostForm('node/' . $node->id() . '/edit', [], t('Save and Publish'));
$this->assertSession()->responseContains(t('Page %label has been updated.', ['%label' => $node->toLink($node->label())->toString()]));
// Create a forward revision with no changes.
// Create a pending revision with no changes.
$this->drupalPostForm('node/' . $node->id() . '/edit', [], t('Save and Create New Draft'));
$this->assertSession()->responseContains(t('Page %label has been updated.', ['%label' => $node->toLink($node->label())->toString()]));
......
......@@ -427,14 +427,14 @@ public function testPagePreviewWithRevisions() {
$this->assertFieldByName('revision_log[0][value]', $edit['revision_log[0][value]'], 'Revision log field displayed.');
// Save the node after coming back from the preview page so we can create a
// forward revision for it.
// pending revision for it.
$this->drupalPostForm(NULL, [], t('Save'));
$node = $this->drupalGetNodeByTitle($edit[$title_key]);
// Check that previewing a forward revision of a node works. This can not be
// Check that previewing a pending revision of a node works. This can not be
// accomplished through the UI so we have to use API calls.
// @todo Change this test to use the UI when we will be able to create
// forward revisions in core.
// pending revisions in core.
// @see https://www.drupal.org/node/2725533
$node->setNewRevision(TRUE);
$node->isDefaultRevision(FALSE);
......
......@@ -5,7 +5,7 @@
use Symfony\Component\Validator\Constraint;
/**
* Validation constraint for changing path aliases in forward revisions.
* Validation constraint for changing path aliases in pending revisions.
*
* @Constraint(
* id = "PathAlias",
......
......@@ -9,7 +9,7 @@
use Symfony\Component\Validator\ConstraintValidator;
/**
* Constraint validator for changing path aliases in forward revisions.
* Constraint validator for changing path aliases in pending revisions.
*/
class PathAliasConstraintValidator extends ConstraintValidator implements ContainerInjectionInterface {
......
......@@ -52,11 +52,11 @@ public function testNodePathAlias() {
], t('Save and Publish'));
$node = $this->getNodeByTitle('moderated content');
// Add a forward revision with the same alias.
// Add a pending revision with the same alias.
$this->drupalGet('node/' . $node->id() . '/edit');
$this->assertSession()->fieldValueEquals('path[0][alias]', '/moderated-content');
$this->drupalPostForm(NULL, [
'title[0][value]' => 'forward revision',
'title[0][value]' => 'pending revision',
'path[0][alias]' => '/moderated-content',
], t('Save and Create New Draft'));
$this->assertSession()->pageTextNotContains('You can only change the URL alias for the published version of this content.');
......@@ -70,12 +70,12 @@ public function testNodePathAlias() {
], t('Save and Publish'));
$node = $this->getNodeByTitle('moderated content 2');
// Add a forward revision with a new alias.
// Add a pending revision with a new alias.
$this->drupalGet('node/' . $node->id() . '/edit');
$this->assertSession()->fieldValueEquals('path[0][alias]', '');
$this->drupalPostForm(NULL, [
'title[0][value]' => 'forward revision',
'path[0][alias]' => '/forward-revision',
'title[0][value]' => 'pending revision',
'path[0][alias]' => '/pending-revision',
], t('Save and Create New Draft'));
$this->assertSession()->pageTextContains('You can only change the URL alias for the published version of this content.');
......@@ -88,11 +88,11 @@ public function testNodePathAlias() {
], t('Save and Publish'));
$node = $this->getNodeByTitle('moderated content 3');
// Add a forward revision with no path alias.
// Add a pending revision with no path alias.
$this->drupalGet('node/' . $node->id() . '/edit');
$this->assertSession()->fieldValueEquals('path[0][alias]', '');
$this->drupalPostForm(NULL, [
'title[0][value]' => 'forward revision',
'title[0][value]' => 'pending revision',
'path[0][alias]' => '',
], t('Save and Create New Draft'));
$this->assertSession()->pageTextNotContains('You can only change the URL alias for the published version of this content.');
......
......@@ -135,28 +135,28 @@ public function testEntityRevisionParamConverter() {
$entity->addTranslation('de', ['name' => 'default revision - de']);
$entity->save();
$forward_revision = \Drupal::entityTypeManager()->getStorage('entity_test_mulrev')->loadUnchanged($entity->id());
$pending_revision = \Drupal::entityTypeManager()->getStorage('entity_test_mulrev')->loadUnchanged($entity->id());
$forward_revision->setNewRevision();
$forward_revision->isDefaultRevision(FALSE);
$pending_revision->setNewRevision();
$pending_revision->isDefaultRevision(FALSE);
$forward_revision->name = 'forward revision - en';
$forward_revision->save();
$pending_revision->name = 'pending revision - en';
$pending_revision->save();
$forward_revision_translation = $forward_revision->getTranslation('de');
$forward_revision_translation->name = 'forward revision - de';
$forward_revision_translation->save();
$pending_revision_translation = $pending_revision->getTranslation('de');
$pending_revision_translation->name = 'pending revision - de';
$pending_revision_translation->save();
// Check that the entity revision is upcasted in the correct language.
$revision_url = 'entity_test_mulrev/' . $entity->id() . '/revision/' . $forward_revision->getRevisionId() . '/view';
$revision_url = 'entity_test_mulrev/' . $entity->id() . '/revision/' . $pending_revision->getRevisionId() . '/view';
$this->drupalGet($revision_url);
$this->assertText('forward revision - en');
$this->assertNoText('forward revision - de');
$this->assertText('pending revision - en');
$this->assertNoText('pending revision - de');
$this->drupalGet('de/' . $revision_url);
$this->assertText('forward revision - de');
$this->assertNoText('forward revision - en');
$this->assertText('pending revision - de');
$this->assertNoText('pending revision - en');
}
}
......@@ -11,11 +11,11 @@
use Drupal\taxonomy\Entity\Vocabulary;
/**
* Kernel tests for taxonomy forward revisions.
* Kernel tests for taxonomy pending revisions.
*
* @group taxonomy
*/
class ForwardRevisionTest extends KernelTestBase {
class PendingRevisionTest extends KernelTestBase {
/**
* {@inheritdoc}
......@@ -35,9 +35,9 @@ protected function setUp() {
}
/**
* Tests that the taxonomy index work correctly with forward revisions.
* Tests that the taxonomy index work correctly with pending revisions.
*/
public function testTaxonomyIndexWithForwardRevision() {
public function testTaxonomyIndexWithPendingRevision() {
\Drupal::configFactory()->getEditable('taxonomy.settings')->set('maintain_index_table', TRUE)->save();
Vocabulary::create([
......@@ -92,8 +92,7 @@ public function testTaxonomyIndexWithForwardRevision() {
$taxonomy_index = $this->getTaxonomyIndex();
$this->assertEquals($term2->id(), $taxonomy_index[$node->id()]->tid);
// Check that saving a forward (non-default) revision does not affect the
// taxonomy index.
// Check that saving a pending revision does not affect the taxonomy index.
$node->setNewRevision(TRUE);
$node->isDefaultRevision(FALSE);
$node->field_tags->target_id = $term->id();
......@@ -102,7 +101,7 @@ public function testTaxonomyIndexWithForwardRevision() {
$taxonomy_index = $this->getTaxonomyIndex();
$this->assertEquals($term2->id(), $taxonomy_index[$node->id()]->tid);
// Check that making the previously created forward-revision the default
// Check that making the previously created pending revision the default
// revision updates the taxonomy index correctly.
$node->isDefaultRevision(TRUE);
$node->save();
......
......@@ -37,7 +37,7 @@ protected function setUp($import_test_views = TRUE) {
$this->installSchema('node', 'node_access');
}
public function testViewWithNonDefaultForwardRevision() {
public function testViewWithNonDefaultPendingRevision() {
<