Issue #2890364 by timmillwood, amateescu, plach, xjm: Replace all uses of "forward revision" with "pending revision"

8.5.x
Lee Rowlands 2017-07-31 08:39:37 +10:00
parent 13e93c0476
commit aee577b8a7
No known key found for this signature in database
GPG Key ID: 2B829A3DF9204DC4
31 changed files with 152 additions and 155 deletions

View File

@ -5,7 +5,7 @@ namespace Drupal\book\Plugin\Validation\Constraint;
use Symfony\Component\Validator\Constraint; 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( * @Constraint(
* id = "BookOutline", * id = "BookOutline",

View File

@ -9,7 +9,7 @@ use Symfony\Component\Validator\Constraint;
use Symfony\Component\Validator\ConstraintValidator; 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 { class BookOutlineConstraintValidator extends ConstraintValidator implements ContainerInjectionInterface {

View File

@ -41,7 +41,7 @@ class BookContentModerationTest extends BrowserTestBase {
/** /**
* Tests that book drafts can not modify the book outline. * Tests that book drafts can not modify the book outline.
*/ */
public function testBookWithForwardRevisions() { public function testBookWithPendingRevisions() {
// Create two books. // Create two books.
$book_1_nodes = $this->createBook(t('Save and Publish')); $book_1_nodes = $this->createBook(t('Save and Publish'));
$book_1 = $this->book; $book_1 = $this->book;

View File

@ -7,11 +7,11 @@ use Drupal\node\Entity\NodeType;
use Drupal\KernelTests\KernelTestBase; use Drupal\KernelTests\KernelTestBase;
/** /**
* Tests that the Book module handles forward revisions correctly. * Tests that the Book module handles pending revisions correctly.
* *
* @group book * @group book
*/ */
class BookForwardRevisionTest extends KernelTestBase { class BookPendingRevisionTest extends KernelTestBase {
/** /**
* Modules to enable. * Modules to enable.
@ -34,9 +34,9 @@ class BookForwardRevisionTest extends KernelTestBase {
} }
/** /**
* Tests forward revision handling for books. * Tests pending revision handling for books.
*/ */
public function testBookWithForwardRevisions() { public function testBookWithPendingRevisions() {
$content_type = NodeType::create([ $content_type = NodeType::create([
'type' => $this->randomMachineName(), 'type' => $this->randomMachineName(),
'name' => $this->randomString(), 'name' => $this->randomString(),
@ -65,36 +65,36 @@ class BookForwardRevisionTest extends KernelTestBase {
$child->book['pid'] = $book_1->id(); $child->book['pid'] = $book_1->id();
$child->save(); $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. // revision.
/** @var \Drupal\book\BookManagerInterface $book_manager */ /** @var \Drupal\book\BookManagerInterface $book_manager */
$book_manager = $this->container->get('book.manager'); $book_manager = $this->container->get('book.manager');
// Check that the API doesn't allow us to change the book outline for // 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->book['bid'] = $book_2->id();
$child->setNewRevision(TRUE); $child->setNewRevision(TRUE);
$child->isDefaultRevision(FALSE); $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 // 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 = \Drupal::entityTypeManager()->getStorage('node')->loadUnchanged($child->id());
$child->book['pid'] = $book_1_child->id(); $child->book['pid'] = $book_1_child->id();
$child->setNewRevision(TRUE); $child->setNewRevision(TRUE);
$child->isDefaultRevision(FALSE); $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 // 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 = \Drupal::entityTypeManager()->getStorage('node')->loadUnchanged($child->id());
$child->book['weight'] = 2; $child->book['weight'] = 2;
$child->setNewRevision(TRUE); $child->setNewRevision(TRUE);
$child->isDefaultRevision(FALSE); $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.');
} }
} }

View File

@ -34,7 +34,7 @@ class LatestRevisionCheck implements AccessInterface {
} }
/** /**
* 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 * This checker assumes the presence of an '_entity_access' requirement key
* in the same form as used by EntityAccessCheck. * in the same form as used by EntityAccessCheck.
@ -54,7 +54,7 @@ class LatestRevisionCheck implements AccessInterface {
public function access(Route $route, RouteMatchInterface $route_match, AccountInterface $account) { public function access(Route $route, RouteMatchInterface $route_match, AccountInterface $account) {
// This tab should not show up unless there's a reason to show it. // This tab should not show up unless there's a reason to show it.
$entity = $this->loadEntity($route, $route_match); $entity = $this->loadEntity($route, $route_match);
if ($this->moderationInfo->hasForwardRevision($entity)) { if ($this->moderationInfo->hasPendingRevision($entity)) {
// Check the global permissions first. // Check the global permissions first.
$access_result = AccessResult::allowedIfHasPermissions($account, ['view latest version', 'view any unpublished content']); $access_result = AccessResult::allowedIfHasPermissions($account, ['view latest version', 'view any unpublished content']);
if (!$access_result->isAllowed()) { if (!$access_result->isAllowed()) {

View File

@ -242,8 +242,8 @@ class EntityOperations implements ContainerInjectionInterface {
// Don't display the moderation form when when: // Don't display the moderation form when when:
// - The revision is not translation affected. // - The revision is not translation affected.
// - There are more than one translation languages. // - There are more than one translation languages.
// - The entity has forward revisions. // - The entity has pending revisions.
if (!$this->moderationInfo->isForwardRevisionAllowed($entity)) { if (!$this->moderationInfo->isPendingRevisionAllowed($entity)) {
return; return;
} }

View File

@ -300,7 +300,7 @@ class EntityTypeInfo implements ContainerInjectionInterface {
->getHandler($entity->getEntityTypeId(), 'moderation') ->getHandler($entity->getEntityTypeId(), 'moderation')
->enforceRevisionsEntityFormAlter($form, $form_state, $form_id); ->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()); $latest_revision = $this->moderationInfo->getLatestRevision($entity->getEntityTypeId(), $entity->id());
if ($entity->bundle()) { if ($entity->bundle()) {
$bundle_type_id = $entity->getEntityType()->getBundleEntityType(); $bundle_type_id = $entity->getEntityType()->getBundleEntityType();
@ -318,8 +318,8 @@ class EntityTypeInfo implements ContainerInjectionInterface {
'@latest_revision_delete_url' => $translation->toUrl('delete-form', ['language' => $translation->language()])->toString(), '@latest_revision_delete_url' => $translation->toUrl('delete-form', ['language' => $translation->language()])->toString(),
]; ];
$label = $this->t('Unable to save this @type_label.', $args); $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); $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 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 revision to allow all workflow transitions.', $args);
drupal_set_message($full_message, 'error'); drupal_set_message($full_message, 'error');
$form['actions']['#access'] = FALSE; $form['actions']['#access'] = FALSE;
@ -351,7 +351,7 @@ class EntityTypeInfo implements ContainerInjectionInterface {
} }
/** /**
* 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 * When saving their changes, editors should see those changes displayed on
* the next page. * the next page.
@ -366,7 +366,7 @@ class EntityTypeInfo implements ContainerInjectionInterface {
$entity = $form_state->getFormObject()->getEntity(); $entity = $form_state->getFormObject()->getEntity();
$moderation_info = \Drupal::getContainer()->get('content_moderation.moderation_information'); $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(); $entity_type_id = $entity->getEntityTypeId();
$form_state->setRedirect("entity.$entity_type_id.latest_version", [$entity_type_id => $entity->id()]); $form_state->setRedirect("entity.$entity_type_id.latest_version", [$entity_type_id => $entity->id()]);
} }

View File

@ -140,7 +140,7 @@ class EntityModerationForm extends FormBase {
$new_state = $this->moderationInfo->getWorkflowForEntity($entity)->getTypePlugin()->getState($new_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 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 // 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. // still exist.
if ($new_state->isDefaultRevisionState()) { if ($new_state->isDefaultRevisionState()) {
$form_state->setRedirectUrl($entity->toUrl('canonical')); $form_state->setRedirectUrl($entity->toUrl('canonical'));

View File

@ -127,8 +127,8 @@ class ModerationInformation implements ModerationInformationInterface {
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function isForwardRevisionAllowed(ContentEntityInterface $entity) { public function isPendingRevisionAllowed(ContentEntityInterface $entity) {
return !(!$entity->isRevisionTranslationAffected() && count($entity->getTranslationLanguages()) > 1 && $this->hasForwardRevision($entity)); return !(!$entity->isRevisionTranslationAffected() && count($entity->getTranslationLanguages()) > 1 && $this->hasPendingRevision($entity));
} }
/** /**
@ -141,7 +141,7 @@ class ModerationInformation implements ModerationInformationInterface {
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function hasForwardRevision(ContentEntityInterface $entity) { public function hasPendingRevision(ContentEntityInterface $entity) {
return $this->isModeratedEntity($entity) return $this->isModeratedEntity($entity)
&& !($this->getLatestRevisionId($entity->getEntityTypeId(), $entity->id()) == $this->getDefaultRevisionId($entity->getEntityTypeId(), $entity->id())); && !($this->getLatestRevisionId($entity->getEntityTypeId(), $entity->id()) == $this->getDefaultRevisionId($entity->getEntityTypeId(), $entity->id()));
} }

View File

@ -101,7 +101,7 @@ interface ModerationInformationInterface {
public function getAffectedRevisionTranslation(ContentEntityInterface $entity); public function getAffectedRevisionTranslation(ContentEntityInterface $entity);
/** /**
* Determines if forward revisions are allowed. * Determines if pending revisions are allowed.
* *
* @internal * @internal
* *
@ -109,9 +109,9 @@ interface ModerationInformationInterface {
* The content entity. * The content entity.
* *
* @return bool * @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. * Determines if an entity is a latest revision.
@ -126,15 +126,15 @@ interface ModerationInformationInterface {
public function isLatestRevision(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 * @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 * @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". * Determines if an entity is "live".

View File

@ -41,23 +41,23 @@ class EntityRevisionConverter extends EntityConverter {
* {@inheritdoc} * {@inheritdoc}
*/ */
public function applies($definition, $name, Route $route) { 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 * 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 * @param array $definition
* The parameter definition provided in the route options. * The parameter definition provided in the route options.
* *
* @return bool * @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) { protected function hasPendingRevisionFlag(array $definition) {
return (isset($definition['load_forward_revision']) && $definition['load_forward_revision']); return (isset($definition['load_pending_revision']) && $definition['load_pending_revision']);
} }
/** /**

View File

@ -88,7 +88,7 @@ class EntityModerationRouteProvider implements EntityRouteProviderInterface, Ent
->setOption('parameters', [ ->setOption('parameters', [
$entity_type_id => [ $entity_type_id => [
'type' => 'entity:' . $entity_type_id, 'type' => 'entity:' . $entity_type_id,
'load_forward_revision' => 1, 'load_pending_revision' => 1,
], ],
]); ]);

View File

@ -36,9 +36,7 @@ class ModerationFormTest extends ModerationStateTestBase {
/** /**
* Tests the moderation form that shows on the latest version page. * Tests the moderation form that shows on the latest version page.
* *
* The latest version page only shows if there is a forward revision. There * The latest version page only shows if there is a pending revision.
* is only a forward revision if a draft revision is created on a node where
* the default revision is not a published moderation state.
* *
* @see \Drupal\content_moderation\EntityOperations * @see \Drupal\content_moderation\EntityOperations
* @see \Drupal\Tests\content_moderation\Functional\ModerationStateBlockTest::testCustomBlockModeration * @see \Drupal\Tests\content_moderation\Functional\ModerationStateBlockTest::testCustomBlockModeration
@ -63,7 +61,7 @@ class ModerationFormTest extends ModerationStateTestBase {
$this->assertResponse(200); $this->assertResponse(200);
$this->assertField('edit-new-state', 'The node view page has a moderation form.'); $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 // The latest version page should not show, because there is no pending
// revision. // revision.
$this->drupalGet($latest_version_path); $this->drupalGet($latest_version_path);
$this->assertResponse(403); $this->assertResponse(403);
@ -80,7 +78,7 @@ class ModerationFormTest extends ModerationStateTestBase {
$this->assertField('edit-new-state', 'The node view page has a moderation form.'); $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 // The latest version page should not show, because there is still no
// forward revision. // pending revision.
$this->drupalGet($latest_version_path); $this->drupalGet($latest_version_path);
$this->assertResponse(403); $this->assertResponse(403);
@ -96,11 +94,11 @@ class ModerationFormTest extends ModerationStateTestBase {
$this->assertNoField('edit-new-state', 'The node view page has no moderation form.'); $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 // The latest version page should not show, because there is still no
// forward revision. // pending revision.
$this->drupalGet($latest_version_path); $this->drupalGet($latest_version_path);
$this->assertResponse(403); $this->assertResponse(403);
// Make a forward revision. // Make a pending revision.
$this->drupalPostForm($edit_path, [ $this->drupalPostForm($edit_path, [
'body[0][value]' => 'Fourth version of the content.', 'body[0][value]' => 'Fourth version of the content.',
], t('Save and Create New Draft')); ], t('Save and Create New Draft'));
@ -112,7 +110,7 @@ class ModerationFormTest extends ModerationStateTestBase {
$this->assertNoField('edit-new-state', 'The node view page has no moderation form.'); $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" // The latest version page should show the moderation form and have "Draft"
// status, because the forward revision is in "Draft". // status, because the pending revision is in "Draft".
$this->drupalGet($latest_version_path); $this->drupalGet($latest_version_path);
$this->assertResponse(200); $this->assertResponse(200);
$this->assertField('edit-new-state', 'The latest-version page has a moderation form.'); $this->assertField('edit-new-state', 'The latest-version page has a moderation form.');
@ -124,7 +122,7 @@ class ModerationFormTest extends ModerationStateTestBase {
], t('Apply')); ], t('Apply'));
// The latest version page should not show, because there is no // The latest version page should not show, because there is no
// forward revision. // pending revision.
$this->drupalGet($latest_version_path); $this->drupalGet($latest_version_path);
$this->assertResponse(403); $this->assertResponse(403);
} }
@ -141,7 +139,7 @@ class ModerationFormTest extends ModerationStateTestBase {
// Create new moderated content in draft. // Create new moderated content in draft.
$this->drupalPostForm('entity_test_mulrevpub/add', [], t('Save and Create New Draft')); $this->drupalPostForm('entity_test_mulrevpub/add', [], t('Save and Create New Draft'));
// The latest version page should not show, because there is no forward // The latest version page should not show, because there is no pending
// revision. // revision.
$this->drupalGet('/entity_test_mulrevpub/manage/1/latest'); $this->drupalGet('/entity_test_mulrevpub/manage/1/latest');
$this->assertResponse(403); $this->assertResponse(403);
@ -150,7 +148,7 @@ class ModerationFormTest extends ModerationStateTestBase {
$this->drupalPostForm('entity_test_mulrevpub/manage/1/edit', [], t('Save and Create New Draft')); $this->drupalPostForm('entity_test_mulrevpub/manage/1/edit', [], t('Save and Create New Draft'));
// The latest version page should not show, because there is still no // The latest version page should not show, because there is still no
// forward revision. // pending revision.
$this->drupalGet('/entity_test_mulrevpub/manage/1/latest'); $this->drupalGet('/entity_test_mulrevpub/manage/1/latest');
$this->assertResponse(403); $this->assertResponse(403);
@ -164,11 +162,11 @@ class ModerationFormTest extends ModerationStateTestBase {
$this->assertNoText('Status', 'The node view page has no moderation form.'); $this->assertNoText('Status', 'The node view page has no moderation form.');
// The latest version page should not show, because there is still no // The latest version page should not show, because there is still no
// forward revision. // pending revision.
$this->drupalGet('entity_test_mulrevpub/manage/1/latest'); $this->drupalGet('entity_test_mulrevpub/manage/1/latest');
$this->assertResponse(403); $this->assertResponse(403);
// Make a forward revision. // Make a pending revision.
$this->drupalPostForm('entity_test_mulrevpub/manage/1/edit', [], t('Save and Create New Draft')); $this->drupalPostForm('entity_test_mulrevpub/manage/1/edit', [], t('Save and Create New Draft'));
// The published view should not have a moderation form, because it is the // The published view should not have a moderation form, because it is the
@ -178,7 +176,7 @@ class ModerationFormTest extends ModerationStateTestBase {
$this->assertNoText('Status', 'The node view page has no moderation form.'); $this->assertNoText('Status', 'The node view page has no moderation form.');
// The latest version page should show the moderation form and have "Draft" // The latest version page should show the moderation form and have "Draft"
// status, because the forward revision is in "Draft". // status, because the pending revision is in "Draft".
$this->drupalGet('entity_test_mulrevpub/manage/1/latest'); $this->drupalGet('entity_test_mulrevpub/manage/1/latest');
$this->assertResponse(200); $this->assertResponse(200);
$this->assertText('Status', 'Form text found on the latest-version page.'); $this->assertText('Status', 'Form text found on the latest-version page.');
@ -190,7 +188,7 @@ class ModerationFormTest extends ModerationStateTestBase {
], t('Apply')); ], t('Apply'));
// The latest version page should not show, because there is no // The latest version page should not show, because there is no
// forward revision. // pending revision.
$this->drupalGet('entity_test_mulrevpub/manage/1/latest'); $this->drupalGet('entity_test_mulrevpub/manage/1/latest');
$this->assertResponse(403); $this->assertResponse(403);
} }
@ -201,7 +199,7 @@ class ModerationFormTest extends ModerationStateTestBase {
public function testModerationFormSetsRevisionAuthor() { public function testModerationFormSetsRevisionAuthor() {
// Create new moderated content in published. // Create new moderated content in published.
$node = $this->createNode(['type' => 'moderated_content', 'moderation_state' => 'published']); $node = $this->createNode(['type' => 'moderated_content', 'moderation_state' => 'published']);
// Make a forward revision. // Make a pending revision.
$node->title = $this->randomMachineName(); $node->title = $this->randomMachineName();
$node->moderation_state->value = 'draft'; $node->moderation_state->value = 'draft';
$node->save(); $node->save();
@ -273,7 +271,7 @@ class ModerationFormTest extends ModerationStateTestBase {
$this->assertSession()->statusCodeEquals('403'); $this->assertSession()->statusCodeEquals('403');
$this->assertFalse($this->xpath('//ul[@class="entity-moderation-form"]')); $this->assertFalse($this->xpath('//ul[@class="entity-moderation-form"]'));
// Add french forward revision (revision 3). // Add french pending revision (revision 3).
$this->drupalGet($edit_path, ['language' => $french]); $this->drupalGet($edit_path, ['language' => $french]);
$this->assertTrue($this->xpath('//input[@value="Save and Create New Draft (this translation)"]')); $this->assertTrue($this->xpath('//input[@value="Save and Create New Draft (this translation)"]'));
$this->assertTrue($this->xpath('//input[@value="Save and Publish (this translation)"]')); $this->assertTrue($this->xpath('//input[@value="Save and Publish (this translation)"]'));
@ -302,7 +300,7 @@ class ModerationFormTest extends ModerationStateTestBase {
$this->drupalGet($latest_version_path); $this->drupalGet($latest_version_path);
$this->assertFalse($this->xpath('//ul[@class="entity-moderation-form"]')); $this->assertFalse($this->xpath('//ul[@class="entity-moderation-form"]'));
// Publish the french forward revision (revision 4). // Publish the french pending revision (revision 4).
$this->drupalGet($edit_path, ['language' => $french]); $this->drupalGet($edit_path, ['language' => $french]);
$this->assertTrue($this->xpath('//input[@value="Save and Create New Draft (this translation)"]')); $this->assertTrue($this->xpath('//input[@value="Save and Create New Draft (this translation)"]'));
$this->assertTrue($this->xpath('//input[@value="Save and Publish (this translation)"]')); $this->assertTrue($this->xpath('//input[@value="Save and Publish (this translation)"]'));
@ -326,13 +324,13 @@ class ModerationFormTest extends ModerationStateTestBase {
$this->drupalGet($latest_version_path); $this->drupalGet($latest_version_path);
$this->assertFalse($this->xpath('//ul[@class="entity-moderation-form"]')); $this->assertFalse($this->xpath('//ul[@class="entity-moderation-form"]'));
// Make sure we're allowed to create a forward french revision. // Make sure we're allowed to create a pending french revision.
$this->drupalGet($edit_path, ['language' => $french]); $this->drupalGet($edit_path, ['language' => $french]);
$this->assertTrue($this->xpath('//input[@value="Save and Create New Draft (this translation)"]')); $this->assertTrue($this->xpath('//input[@value="Save and Create New Draft (this translation)"]'));
$this->assertTrue($this->xpath('//input[@value="Save and Publish (this translation)"]')); $this->assertTrue($this->xpath('//input[@value="Save and Publish (this translation)"]'));
$this->assertTrue($this->xpath('//input[@value="Save and Archive (this translation)"]')); $this->assertTrue($this->xpath('//input[@value="Save and Archive (this translation)"]'));
// Add a english forward revision (revision 6). // Add a english pending revision (revision 6).
$this->drupalGet($edit_path); $this->drupalGet($edit_path);
$this->assertTrue($this->xpath('//input[@value="Save and Create New Draft (this translation)"]')); $this->assertTrue($this->xpath('//input[@value="Save and Create New Draft (this translation)"]'));
$this->assertTrue($this->xpath('//input[@value="Save and Publish (this translation)"]')); $this->assertTrue($this->xpath('//input[@value="Save and Publish (this translation)"]'));
@ -344,7 +342,7 @@ class ModerationFormTest extends ModerationStateTestBase {
$this->drupalGet($latest_version_path); $this->drupalGet($latest_version_path);
$this->assertTrue($this->xpath('//ul[@class="entity-moderation-form"]')); $this->assertTrue($this->xpath('//ul[@class="entity-moderation-form"]'));
// Make sure we're not allowed to create a forward french revision. // Make sure we're not allowed to create a pending french revision.
$this->drupalGet($edit_path, ['language' => $french]); $this->drupalGet($edit_path, ['language' => $french]);
$this->assertFalse($this->xpath('//input[@value="Save and Create New Draft (this translation)"]')); $this->assertFalse($this->xpath('//input[@value="Save and Create New Draft (this translation)"]'));
$this->assertFalse($this->xpath('//input[@value="Save and Publish (this translation)"]')); $this->assertFalse($this->xpath('//input[@value="Save and Publish (this translation)"]'));
@ -354,7 +352,7 @@ class ModerationFormTest extends ModerationStateTestBase {
$this->drupalGet($latest_version_path, ['language' => $french]); $this->drupalGet($latest_version_path, ['language' => $french]);
$this->assertFalse($this->xpath('//ul[@class="entity-moderation-form"]')); $this->assertFalse($this->xpath('//ul[@class="entity-moderation-form"]'));
// We should be able to publish the english forward revision (revision 7) // We should be able to publish the english pending revision (revision 7)
$this->drupalGet($edit_path); $this->drupalGet($edit_path);
$this->assertTrue($this->xpath('//input[@value="Save and Create New Draft (this translation)"]')); $this->assertTrue($this->xpath('//input[@value="Save and Create New Draft (this translation)"]'));
$this->assertTrue($this->xpath('//input[@value="Save and Publish (this translation)"]')); $this->assertTrue($this->xpath('//input[@value="Save and Publish (this translation)"]'));
@ -366,13 +364,13 @@ class ModerationFormTest extends ModerationStateTestBase {
$this->drupalGet($latest_version_path); $this->drupalGet($latest_version_path);
$this->assertFalse($this->xpath('//ul[@class="entity-moderation-form"]')); $this->assertFalse($this->xpath('//ul[@class="entity-moderation-form"]'));
// Make sure we're allowed to create a forward french revision. // Make sure we're allowed to create a pending french revision.
$this->drupalGet($edit_path, ['language' => $french]); $this->drupalGet($edit_path, ['language' => $french]);
$this->assertTrue($this->xpath('//input[@value="Save and Create New Draft (this translation)"]')); $this->assertTrue($this->xpath('//input[@value="Save and Create New Draft (this translation)"]'));
$this->assertTrue($this->xpath('//input[@value="Save and Publish (this translation)"]')); $this->assertTrue($this->xpath('//input[@value="Save and Publish (this translation)"]'));
$this->assertTrue($this->xpath('//input[@value="Save and Archive (this translation)"]')); $this->assertTrue($this->xpath('//input[@value="Save and Archive (this translation)"]'));
// Make sure we're allowed to create a forward english revision. // Make sure we're allowed to create a pending english revision.
$this->drupalGet($edit_path); $this->drupalGet($edit_path);
$this->assertTrue($this->xpath('//input[@value="Save and Create New Draft (this translation)"]')); $this->assertTrue($this->xpath('//input[@value="Save and Create New Draft (this translation)"]'));
$this->assertTrue($this->xpath('//input[@value="Save and Publish (this translation)"]')); $this->assertTrue($this->xpath('//input[@value="Save and Publish (this translation)"]'));
@ -389,7 +387,7 @@ class ModerationFormTest extends ModerationStateTestBase {
$edit_path = sprintf('node/%d/edit', $node->id()); $edit_path = sprintf('node/%d/edit', $node->id());
$translate_path = sprintf('node/%d/translations/add/en/fr', $node->id()); $translate_path = sprintf('node/%d/translations/add/en/fr', $node->id());
// Add a forward revision (revision 2). // Add a pending revision (revision 2).
$this->drupalGet($edit_path); $this->drupalGet($edit_path);
$this->assertTrue($this->xpath('//input[@value="Save and Create New Draft (this translation)"]')); $this->assertTrue($this->xpath('//input[@value="Save and Create New Draft (this translation)"]'));
$this->assertTrue($this->xpath('//input[@value="Save and Publish (this translation)"]')); $this->assertTrue($this->xpath('//input[@value="Save and Publish (this translation)"]'));
@ -398,7 +396,7 @@ class ModerationFormTest extends ModerationStateTestBase {
'body[0][value]' => 'Second version of the content.', 'body[0][value]' => 'Second version of the content.',
], t('Save and Create New Draft (this translation)')); ], t('Save and Create New Draft (this translation)'));
// It shouldn't be possible to translate as we have a forward revision. // It shouldn't be possible to translate as we have a pending revision.
$this->drupalGet($translate_path); $this->drupalGet($translate_path);
$this->assertFalse($this->xpath('//input[@value="Save and Create New Draft (this translation)"]')); $this->assertFalse($this->xpath('//input[@value="Save and Create New Draft (this translation)"]'));
$this->assertFalse($this->xpath('//input[@value="Save and Publish (this translation)"]')); $this->assertFalse($this->xpath('//input[@value="Save and Publish (this translation)"]'));

View File

@ -93,18 +93,18 @@ class ModerationStateBlockTest extends ModerationStateTestBase {
$this->drupalGet(''); $this->drupalGet('');
$this->assertText($updated_body); $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')); $this->drupalPostForm('block/' . $block->id(), [], t('Save and Publish'));
// Create a forward revision. // Create a pending revision.
$forward_revision_body = 'This is the forward revision body value'; $pending_revision_body = 'This is the pending revision body value';
$edit = [ $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->drupalPostForm('block/' . $block->id(), $edit, t('Save and Create New Draft'));
$this->assertText(t('basic Moderated block has been updated.')); $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. // since it should not be set as the default revision.
$this->drupalGet(''); $this->drupalGet('');
$this->assertText($updated_body); $this->assertText($updated_body);
@ -116,10 +116,10 @@ class ModerationStateBlockTest extends ModerationStateTestBase {
$this->drupalPostForm('block/' . $block->id() . '/latest', $edit, t('Apply')); $this->drupalPostForm('block/' . $block->id() . '/latest', $edit, t('Apply'));
$this->assertText(t('The moderation state has been updated.')); $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. // default revision and therefore visible.
$this->drupalGet(''); $this->drupalGet('');
$this->assertText($forward_revision_body); $this->assertText($pending_revision_body);
} }
} }

View File

@ -105,7 +105,7 @@ class ModerationStateNodeTest extends ModerationStateTestBase {
$this->assertUrl(Url::fromRoute('entity.node.canonical', ['node' => $node->id()])); $this->assertUrl(Url::fromRoute('entity.node.canonical', ['node' => $node->id()]));
$this->assertText('Third version of the content.'); $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. // version" tab.
$this->drupalPostForm($edit_path, [ $this->drupalPostForm($edit_path, [
'body[0][value]' => 'Fourth version of the content.', 'body[0][value]' => 'Fourth version of the content.',

View File

@ -116,7 +116,7 @@ class NodeAccessTest extends ModerationStateTestBase {
$this->drupalGet($view_path); $this->drupalGet($view_path);
$this->assertResponse(200); $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->drupalLogin($this->adminUser);
$this->drupalPostForm($edit_path, [ $this->drupalPostForm($edit_path, [
'title[0][value]' => 'moderated content revised', 'title[0][value]' => 'moderated content revised',
@ -132,7 +132,7 @@ class NodeAccessTest extends ModerationStateTestBase {
$this->drupalGet($view_path); $this->drupalGet($view_path);
$this->assertResponse(200); $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([ $user = $this->createUser([
'use editorial transition create_new_draft', 'use editorial transition create_new_draft',
]); ]);

View File

@ -55,9 +55,9 @@ class EntityOperationsTest extends KernelTestBase {
} }
/** /**
* 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. // Create a new node in draft.
$page = Node::create([ $page = Node::create([
'type' => 'page', 'type' => 'page',
@ -68,7 +68,7 @@ class EntityOperationsTest extends KernelTestBase {
$id = $page->id(); $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. // revisions doesn't affect the default node load.
/** @var Node $page */ /** @var Node $page */
$page = Node::load($id); $page = Node::load($id);
@ -87,7 +87,7 @@ class EntityOperationsTest extends KernelTestBase {
$this->assertTrue($page->isDefaultRevision()); $this->assertTrue($page->isDefaultRevision());
$this->assertTrue($page->isPublished()); $this->assertTrue($page->isPublished());
// Make a new forward-revision in Draft. // Make a new pending revision in Draft.
$page->setTitle('C'); $page->setTitle('C');
$page->moderation_state->value = 'draft'; $page->moderation_state->value = 'draft';
$page->save(); $page->save();
@ -96,7 +96,7 @@ class EntityOperationsTest extends KernelTestBase {
$page = Node::load($id); $page = Node::load($id);
$this->assertEquals('B', $page->getTitle()); $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, // 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 // so this won't work for non-nodes. We'd need to use entity queries. This
// is a core bug that should get fixed. // is a core bug that should get fixed.

View File

@ -186,13 +186,13 @@ class EntityStateChangeValidationTest extends KernelTestBase {
$node_fr->save(); $node_fr->save();
$this->assertEquals('published', $node_fr->moderation_state->value); $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->moderation_state = 'draft';
$node->setNewRevision(TRUE); $node->setNewRevision(TRUE);
$node->isDefaultRevision(FALSE); $node->isDefaultRevision(FALSE);
$node->save(); $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. // to archived.
$node->moderation_state = 'archived'; $node->moderation_state = 'archived';
$violations = $node->validate(); $violations = $node->validate();

View File

@ -45,8 +45,8 @@ class LatestRevisionCheckTest extends UnitTestCase {
* The class of the entity to mock. * The class of the entity to mock.
* @param string $entity_type * @param string $entity_type
* The machine name of the entity to mock. * The machine name of the entity to mock.
* @param bool $has_forward * @param bool $has_pending_revision
* Whether this entity should have a forward revision in the system. * Whether this entity should have a pending revision in the system.
* @param array $account_permissions * @param array $account_permissions
* An array of permissions the account has. * An array of permissions the account has.
* @param bool $is_owner * @param bool $is_owner
@ -57,7 +57,7 @@ class LatestRevisionCheckTest extends UnitTestCase {
* *
* @dataProvider accessSituationProvider * @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 */ /** @var \Drupal\Core\Session\AccountInterface $account */
$account = $this->prophesize(AccountInterface::class); $account = $this->prophesize(AccountInterface::class);
@ -82,7 +82,7 @@ class LatestRevisionCheckTest extends UnitTestCase {
/** @var \Drupal\content_moderation\ModerationInformation $mod_info */ /** @var \Drupal\content_moderation\ModerationInformation $mod_info */
$mod_info = $this->prophesize(ModerationInformation::class); $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); $route = $this->prophesize(Route::class);
@ -119,13 +119,13 @@ class LatestRevisionCheckTest extends UnitTestCase {
// Node with own content permissions and no latest version, but no perms // Node with own content permissions and no latest version, but no perms
// to view latest version. // to view latest version.
[Node::class, 'node', TRUE, ['view own unpublished content'], FALSE, AccessResultNeutral::class], [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], [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], [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], [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], [BlockContent::class, 'block_content', FALSE, ['view latest version', 'view own unpublished content'], FALSE, AccessResultForbidden::class],
]; ];
} }

View File

@ -5,7 +5,7 @@ namespace Drupal\menu_ui\Plugin\Validation\Constraint;
use Symfony\Component\Validator\Constraint; 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( * @Constraint(
* id = "MenuSettings", * id = "MenuSettings",

View File

@ -6,7 +6,7 @@ use Symfony\Component\Validator\Constraint;
use Symfony\Component\Validator\ConstraintValidator; 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 { class MenuSettingsConstraintValidator extends ConstraintValidator {
@ -25,15 +25,15 @@ class MenuSettingsConstraintValidator extends ConstraintValidator {
$values['parent'] = $parent; $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']) { if (!$defaults['entity_id'] && $values['enabled']) {
$violation_path = 'menu'; $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']) { elseif (empty($values['enabled']) && $defaults['entity_id']) {
$violation_path = 'menu'; $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']) { elseif ($defaults['entity_id']) {
if (($values['title'] != $defaults['title'])) { if (($values['title'] != $defaults['title'])) {
$violation_path = 'menu.title'; $violation_path = 'menu.title';

View File

@ -42,7 +42,7 @@ class MenuUiContentModerationTest extends BrowserTestBase {
/** /**
* Tests that node drafts can not modify the menu settings. * Tests that node drafts can not modify the menu settings.
*/ */
public function testMenuUiWithForwardRevisions() { public function testMenuUiWithPendingRevisions() {
$editor = $this->drupalCreateUser([ $editor = $this->drupalCreateUser([
'administer nodes', 'administer nodes',
'administer menu', 'administer menu',
@ -62,7 +62,7 @@ class MenuUiContentModerationTest extends BrowserTestBase {
$this->drupalPostForm('node/' . $node->id() . '/edit', [], t('Save and Publish')); $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()])); $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->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()])); $this->assertSession()->responseContains(t('Page %label has been updated.', ['%label' => $node->toLink($node->label())->toString()]));

View File

@ -427,14 +427,14 @@ class PagePreviewTest extends NodeTestBase {
$this->assertFieldByName('revision_log[0][value]', $edit['revision_log[0][value]'], 'Revision log field displayed.'); $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 // 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')); $this->drupalPostForm(NULL, [], t('Save'));
$node = $this->drupalGetNodeByTitle($edit[$title_key]); $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. // 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 // @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 // @see https://www.drupal.org/node/2725533
$node->setNewRevision(TRUE); $node->setNewRevision(TRUE);
$node->isDefaultRevision(FALSE); $node->isDefaultRevision(FALSE);

View File

@ -5,7 +5,7 @@ namespace Drupal\path\Plugin\Validation\Constraint;
use Symfony\Component\Validator\Constraint; use Symfony\Component\Validator\Constraint;
/** /**
* Validation constraint for changing path aliases in forward revisions. * Validation constraint for changing path aliases in pending revisions.
* *
* @Constraint( * @Constraint(
* id = "PathAlias", * id = "PathAlias",

View File

@ -9,7 +9,7 @@ use Symfony\Component\Validator\Constraint;
use Symfony\Component\Validator\ConstraintValidator; 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 { class PathAliasConstraintValidator extends ConstraintValidator implements ContainerInjectionInterface {

View File

@ -52,11 +52,11 @@ class PathContentModerationTest extends BrowserTestBase {
], t('Save and Publish')); ], t('Save and Publish'));
$node = $this->getNodeByTitle('moderated content'); $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->drupalGet('node/' . $node->id() . '/edit');
$this->assertSession()->fieldValueEquals('path[0][alias]', '/moderated-content'); $this->assertSession()->fieldValueEquals('path[0][alias]', '/moderated-content');
$this->drupalPostForm(NULL, [ $this->drupalPostForm(NULL, [
'title[0][value]' => 'forward revision', 'title[0][value]' => 'pending revision',
'path[0][alias]' => '/moderated-content', 'path[0][alias]' => '/moderated-content',
], t('Save and Create New Draft')); ], t('Save and Create New Draft'));
$this->assertSession()->pageTextNotContains('You can only change the URL alias for the published version of this content.'); $this->assertSession()->pageTextNotContains('You can only change the URL alias for the published version of this content.');
@ -70,12 +70,12 @@ class PathContentModerationTest extends BrowserTestBase {
], t('Save and Publish')); ], t('Save and Publish'));
$node = $this->getNodeByTitle('moderated content 2'); $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->drupalGet('node/' . $node->id() . '/edit');
$this->assertSession()->fieldValueEquals('path[0][alias]', ''); $this->assertSession()->fieldValueEquals('path[0][alias]', '');
$this->drupalPostForm(NULL, [ $this->drupalPostForm(NULL, [
'title[0][value]' => 'forward revision', 'title[0][value]' => 'pending revision',
'path[0][alias]' => '/forward-revision', 'path[0][alias]' => '/pending-revision',
], t('Save and Create New Draft')); ], t('Save and Create New Draft'));
$this->assertSession()->pageTextContains('You can only change the URL alias for the published version of this content.'); $this->assertSession()->pageTextContains('You can only change the URL alias for the published version of this content.');
@ -88,11 +88,11 @@ class PathContentModerationTest extends BrowserTestBase {
], t('Save and Publish')); ], t('Save and Publish'));
$node = $this->getNodeByTitle('moderated content 3'); $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->drupalGet('node/' . $node->id() . '/edit');
$this->assertSession()->fieldValueEquals('path[0][alias]', ''); $this->assertSession()->fieldValueEquals('path[0][alias]', '');
$this->drupalPostForm(NULL, [ $this->drupalPostForm(NULL, [
'title[0][value]' => 'forward revision', 'title[0][value]' => 'pending revision',
'path[0][alias]' => '', 'path[0][alias]' => '',
], t('Save and Create New Draft')); ], t('Save and Create New Draft'));
$this->assertSession()->pageTextNotContains('You can only change the URL alias for the published version of this content.'); $this->assertSession()->pageTextNotContains('You can only change the URL alias for the published version of this content.');

View File

@ -135,28 +135,28 @@ class EntityRevisionsTest extends BrowserTestBase {
$entity->addTranslation('de', ['name' => 'default revision - de']); $entity->addTranslation('de', ['name' => 'default revision - de']);
$entity->save(); $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(); $pending_revision->setNewRevision();
$forward_revision->isDefaultRevision(FALSE); $pending_revision->isDefaultRevision(FALSE);
$forward_revision->name = 'forward revision - en'; $pending_revision->name = 'pending revision - en';
$forward_revision->save(); $pending_revision->save();
$forward_revision_translation = $forward_revision->getTranslation('de'); $pending_revision_translation = $pending_revision->getTranslation('de');
$forward_revision_translation->name = 'forward revision - de'; $pending_revision_translation->name = 'pending revision - de';
$forward_revision_translation->save(); $pending_revision_translation->save();
// Check that the entity revision is upcasted in the correct language. // 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->drupalGet($revision_url);
$this->assertText('forward revision - en'); $this->assertText('pending revision - en');
$this->assertNoText('forward revision - de'); $this->assertNoText('pending revision - de');
$this->drupalGet('de/' . $revision_url); $this->drupalGet('de/' . $revision_url);
$this->assertText('forward revision - de'); $this->assertText('pending revision - de');
$this->assertNoText('forward revision - en'); $this->assertNoText('pending revision - en');
} }
} }

View File

@ -11,11 +11,11 @@ use Drupal\taxonomy\Entity\Term;
use Drupal\taxonomy\Entity\Vocabulary; use Drupal\taxonomy\Entity\Vocabulary;
/** /**
* Kernel tests for taxonomy forward revisions. * Kernel tests for taxonomy pending revisions.
* *
* @group taxonomy * @group taxonomy
*/ */
class ForwardRevisionTest extends KernelTestBase { class PendingRevisionTest extends KernelTestBase {
/** /**
* {@inheritdoc} * {@inheritdoc}
@ -35,9 +35,9 @@ class ForwardRevisionTest extends KernelTestBase {
} }
/** /**
* 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(); \Drupal::configFactory()->getEditable('taxonomy.settings')->set('maintain_index_table', TRUE)->save();
Vocabulary::create([ Vocabulary::create([
@ -92,8 +92,7 @@ class ForwardRevisionTest extends KernelTestBase {
$taxonomy_index = $this->getTaxonomyIndex(); $taxonomy_index = $this->getTaxonomyIndex();
$this->assertEquals($term2->id(), $taxonomy_index[$node->id()]->tid); $this->assertEquals($term2->id(), $taxonomy_index[$node->id()]->tid);
// Check that saving a forward (non-default) revision does not affect the // Check that saving a pending revision does not affect the taxonomy index.
// taxonomy index.
$node->setNewRevision(TRUE); $node->setNewRevision(TRUE);
$node->isDefaultRevision(FALSE); $node->isDefaultRevision(FALSE);
$node->field_tags->target_id = $term->id(); $node->field_tags->target_id = $term->id();
@ -102,7 +101,7 @@ class ForwardRevisionTest extends KernelTestBase {
$taxonomy_index = $this->getTaxonomyIndex(); $taxonomy_index = $this->getTaxonomyIndex();
$this->assertEquals($term2->id(), $taxonomy_index[$node->id()]->tid); $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. // revision updates the taxonomy index correctly.
$node->isDefaultRevision(TRUE); $node->isDefaultRevision(TRUE);
$node->save(); $node->save();

View File

@ -37,7 +37,7 @@ class SqlEntityLoadingTest extends ViewsKernelTestBase {
$this->installSchema('node', 'node_access'); $this->installSchema('node', 'node_access');
} }
public function testViewWithNonDefaultForwardRevision() { public function testViewWithNonDefaultPendingRevision() {
$node_type = NodeType::create([ $node_type = NodeType::create([
'type' => 'page', 'type' => 'page',
]); ]);

View File

@ -887,9 +887,9 @@ class EntityQueryTest extends EntityKernelTestBase {
} }
/** /**
* Test forward-revisions. * Test pending revisions.
*/ */
public function testForwardRevisions() { public function testPendingRevisions() {
// Ensure entity 14 is returned. // Ensure entity 14 is returned.
$result = \Drupal::entityQuery('entity_test_mulrev') $result = \Drupal::entityQuery('entity_test_mulrev')
->condition('id', [14], 'IN') ->condition('id', [14], 'IN')
@ -914,7 +914,7 @@ class EntityQueryTest extends EntityKernelTestBase {
->execute(); ->execute();
$this->assertEqual(count($result), 1); $this->assertEqual(count($result), 1);
// Verify that field conditions on the default and forward revision are // Verify that field conditions on the default and pending revision are
// work as expected. // work as expected.
$result = \Drupal::entityQuery('entity_test_mulrev') $result = \Drupal::entityQuery('entity_test_mulrev')
->condition('id', [14], 'IN') ->condition('id', [14], 'IN')

View File

@ -88,9 +88,9 @@ class EntityRevisionTranslationTest extends EntityKernelTestBase {
} }
/** /**
* Tests the translation values when saving a forward revision. * Tests the translation values when saving a pending revision.
*/ */
public function testTranslationValuesWhenSavingForwardRevisions() { public function testTranslationValuesWhenSavingPendingRevisions() {
$user = $this->createUser(); $user = $this->createUser();
$storage = $this->entityManager->getStorage('entity_test_mulrev'); $storage = $this->entityManager->getStorage('entity_test_mulrev');
@ -103,33 +103,33 @@ class EntityRevisionTranslationTest extends EntityKernelTestBase {
$entity->addTranslation('de', ['name' => 'default revision - de']); $entity->addTranslation('de', ['name' => 'default revision - de']);
$entity->save(); $entity->save();
// Create a forward revision for the entity and change a field value for // Create a pending revision for the entity and change a field value for
// both languages. // both languages.
$forward_revision = $this->reloadEntity($entity); $pending_revision = $this->reloadEntity($entity);
$forward_revision->setNewRevision(); $pending_revision->setNewRevision();
$forward_revision->isDefaultRevision(FALSE); $pending_revision->isDefaultRevision(FALSE);
$forward_revision->name = 'forward revision - en'; $pending_revision->name = 'pending revision - en';
$forward_revision->save(); $pending_revision->save();
$forward_revision_translation = $forward_revision->getTranslation('de'); $pending_revision_translation = $pending_revision->getTranslation('de');
$forward_revision_translation->name = 'forward revision - de'; $pending_revision_translation->name = 'pending revision - de';
$forward_revision_translation->save(); $pending_revision_translation->save();
$forward_revision_id = $forward_revision->getRevisionId(); $pending_revision_id = $pending_revision->getRevisionId();
$forward_revision = $storage->loadRevision($forward_revision_id); $pending_revision = $storage->loadRevision($pending_revision_id);
// Change the value of the field in the default language, save the forward // Change the value of the field in the default language, save the pending
// revision and check that the value of the field in the second language is // revision and check that the value of the field in the second language is
// also taken from the forward revision, *not* from the default revision. // also taken from the pending revision, *not* from the default revision.
$forward_revision->name = 'updated forward revision - en'; $pending_revision->name = 'updated pending revision - en';
$forward_revision->save(); $pending_revision->save();
$forward_revision = $storage->loadRevision($forward_revision_id); $pending_revision = $storage->loadRevision($pending_revision_id);
$this->assertEquals($forward_revision->name->value, 'updated forward revision - en'); $this->assertEquals($pending_revision->name->value, 'updated pending revision - en');
$this->assertEquals($forward_revision->getTranslation('de')->name->value, 'forward revision - de'); $this->assertEquals($pending_revision->getTranslation('de')->name->value, 'pending revision - de');
} }
/** /**