function WorkspacesUninstallTest::testUninstallingWorkspace

Same name in other branches
  1. 9 core/modules/workspaces/tests/src/Functional/WorkspacesUninstallTest.php \Drupal\Tests\workspaces\Functional\WorkspacesUninstallTest::testUninstallingWorkspace()
  2. 8.9.x core/modules/workspaces/tests/src/Functional/WorkspacesUninstallTest.php \Drupal\Tests\workspaces\Functional\WorkspacesUninstallTest::testUninstallingWorkspace()
  3. 11.x core/modules/workspaces/tests/src/Functional/WorkspacesUninstallTest.php \Drupal\Tests\workspaces\Functional\WorkspacesUninstallTest::testUninstallingWorkspace()

Tests deleting workspace entities and uninstalling Workspaces module.

File

core/modules/workspaces/tests/src/Functional/WorkspacesUninstallTest.php, line 44

Class

WorkspacesUninstallTest
Tests uninstalling the Workspaces module.

Namespace

Drupal\Tests\workspaces\Functional

Code

public function testUninstallingWorkspace() : void {
    $this->createContentType([
        'type' => 'article',
    ]);
    $this->drupalGet('/admin/modules/uninstall');
    $session = $this->assertSession();
    $session->linkExists('Remove workspaces');
    $this->clickLink('Remove workspaces');
    $session->pageTextContains('Are you sure you want to delete all workspaces?');
    $this->drupalGet('/admin/modules/uninstall/entity/workspace');
    $this->submitForm([], 'Delete all workspaces');
    $this->drupalGet('admin/modules/uninstall');
    $this->submitForm([
        'uninstall[workspaces]' => TRUE,
    ], 'Uninstall');
    $this->submitForm([], 'Uninstall');
    $session->pageTextContains('The selected modules have been uninstalled.');
    $session->pageTextNotContains('Workspaces');
    $this->assertFalse(\Drupal::database()->schema()
        ->fieldExists('node_revision', 'workspace'));
    // Verify that the revision metadata key has been removed.
    $this->rebuildContainer();
    $entity_type = \Drupal::entityDefinitionUpdateManager()->getEntityType('node');
    $revision_metadata_keys = $entity_type->get('revision_metadata_keys');
    $this->assertArrayNotHasKey('workspace', $revision_metadata_keys);
}

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