You are here

public function QuickEditLatestRevisionTest::testQuickEditIsAvailableForLatestRevision in Lightning Core 8.5

Tests that Quick Edit is available on the latest revision of an entity.

File

tests/src/FunctionalJavascript/QuickEditLatestRevisionTest.php, line 35

Class

QuickEditLatestRevisionTest
Tests that Quick Edit is available on the latest revision of an entity.

Namespace

Drupal\Tests\lightning_core\FunctionalJavascript

Code

public function testQuickEditIsAvailableForLatestRevision() : void {
  $this
    ->drupalPlaceBlock('local_tasks_block');
  $this
    ->drupalCreateContentType([
    'type' => 'page',
  ]);
  $workflow = $this
    ->createEditorialWorkflow();
  $this
    ->addEntityTypeAndBundleToWorkflow($workflow, 'node', 'page');
  $node = $this
    ->drupalCreateNode([
    'type' => 'page',
    'moderation_state' => 'draft',
    'body' => "Never did this before...",
    'uid' => $this->rootUser
      ->id(),
  ]);
  $node->body->value = "...but it's published now!";
  $node->moderation_state->value = 'published';
  $node
    ->save();
  $node->body->value = "Back to the ol' drawing board.";
  $node->moderation_state->value = 'draft';
  $node
    ->save();
  $assert_session = $this
    ->assertSession();
  $this
    ->drupalLogin($this->rootUser);
  $this
    ->drupalGet($node
    ->toUrl());
  $assert_session
    ->pageTextContains("...but it's published now!");
  $this
    ->getSession()
    ->getPage()
    ->clickLink('Latest version');
  $assert_session
    ->pageTextContains("Back to the ol' drawing board.");
  $this
    ->awaitQuickEditForEntity('node', $node
    ->id());
}