public function WorkspaceTest::testDeleteWorkspaceWithExistingContent in Drupal 9
Same name and namespace in other branches
- 10 core/modules/workspaces/tests/src/Functional/WorkspaceTest.php \Drupal\Tests\workspaces\Functional\WorkspaceTest::testDeleteWorkspaceWithExistingContent()
Verifies that a workspace with existing content may be deleted.
File
- core/
modules/ workspaces/ tests/ src/ Functional/ WorkspaceTest.php, line 251
Class
- WorkspaceTest
- Test the workspace entity.
Namespace
Drupal\Tests\workspaces\FunctionalCode
public function testDeleteWorkspaceWithExistingContent() {
$this
->createContentType([
'type' => 'test',
'label' => 'Test',
]);
$this
->setupWorkspaceSwitcherBlock();
// Login and create a workspace.
$this
->drupalLogin($this->rootUser);
$may_4 = $this
->createWorkspaceThroughUi('May 4', 'may_4');
$this
->switchToWorkspace($may_4);
// Create a node in the workspace.
$node = $this
->createNodeThroughUi('A mayfly flies / In May or June', 'test');
// Delete the workspace.
$this
->drupalGet('/admin/config/workflow/workspaces/manage/may_4/delete');
$this
->assertSession()
->statusCodeEquals(200);
$page = $this
->getSession()
->getPage();
$page
->findButton('Delete')
->click();
$page
->hasContent('The workspace May 4 has been deleted.');
}