WorkspacesUninstallTest.php in Drupal 9
File
core/modules/workspaces/tests/src/Functional/WorkspacesUninstallTest.php
View source
<?php
namespace Drupal\Tests\workspaces\Functional;
use Drupal\Tests\BrowserTestBase;
class WorkspacesUninstallTest extends BrowserTestBase {
protected $profile = 'standard';
protected static $modules = [
'workspaces',
];
protected $defaultTheme = 'stark';
public function testUninstallingWorkspace() {
$this
->drupalLogin($this->rootUser);
$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'));
$this
->rebuildContainer();
$entity_type = \Drupal::entityDefinitionUpdateManager()
->getEntityType('node');
$revision_metadata_keys = $entity_type
->get('revision_metadata_keys');
$this
->assertArrayNotHasKey('workspace', $revision_metadata_keys);
}
}