You are here

public function ModeratedContentLocalTaskTest::testModeratedContentLocalTask in Drupal 10

Same name and namespace in other branches
  1. 9 core/modules/content_moderation/tests/src/Functional/ModeratedContentLocalTaskTest.php \Drupal\Tests\content_moderation\Functional\ModeratedContentLocalTaskTest::testModeratedContentLocalTask()

Tests the moderated content local task appears.

File

core/modules/content_moderation/tests/src/Functional/ModeratedContentLocalTaskTest.php, line 53

Class

ModeratedContentLocalTaskTest
Tests moderated content dynamic local task.

Namespace

Drupal\Tests\content_moderation\Functional

Code

public function testModeratedContentLocalTask() {
  $this
    ->drupalLogin($this->adminUser);

  // Verify the moderated content tab exists.
  $this
    ->drupalGet('admin/content');
  $this
    ->assertSession()
    ->statusCodeEquals(200);
  $this
    ->assertSession()
    ->linkExists('Moderated content');

  // Uninstall the node module which should also remove the tab.
  $this->container
    ->get('module_installer')
    ->uninstall([
    'node',
  ]);

  // Verify the moderated content local task does not exist without the node
  // module installed.
  $this
    ->drupalGet('admin/content');
  $this
    ->assertSession()
    ->statusCodeEquals(200);
  $this
    ->assertSession()
    ->linkNotExists('Moderated content');
}