function NodeRevisionsUiTest::testNodeDuplicateRevisionsTab

Same name in other branches
  1. 10 core/modules/node/tests/src/Functional/NodeRevisionsUiTest.php \Drupal\Tests\node\Functional\NodeRevisionsUiTest::testNodeDuplicateRevisionsTab()

Checks the Revisions tab.

Tests two 'Revisions' local tasks are not added by both Node and VersionHistoryLocalTasks.

This can be removed after 'entity.node.version_history' local task is removed by https://www.drupal.org/project/drupal/issues/3153559.

@covers node_local_tasks_alter

File

core/modules/node/tests/src/Functional/NodeRevisionsUiTest.php, line 208

Class

NodeRevisionsUiTest
Tests the UI for controlling node revision behavior.

Namespace

Drupal\Tests\node\Functional

Code

public function testNodeDuplicateRevisionsTab() : void {
    $this->drupalPlaceBlock('local_tasks_block');
    $this->drupalLogin($this->editor);
    $node = $this->drupalCreateNode();
    $this->drupalGet($node->toUrl('edit-form'));
    // There must be exactly one 'Revisions' local task.
    $xpath = $this->assertSession()
        ->buildXPathQuery('//a[contains(@href, :href)]', [
        ':href' => $node->toUrl('version-history')
            ->toString(),
    ]);
    $this->assertSession()
        ->elementsCount('xpath', $xpath, 1);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.