Skip to content
Snippets Groups Projects

Issue #3438769 - Workspace cleanup with test coverage for sub-workspaces.

Closed Issue #3438769 - Workspace cleanup with test coverage for sub-workspaces.
4 unresolved threads
Closed Vinmayi requested to merge issue/drupal-3438769:3438769-sub-workspace-does-not-clear into 11.x
4 unresolved threads

Closes #3438769

Merge request reports

Approval is optional
Code Quality is loading
Test summary results are being parsed

Closed by catchcatch 4 months ago (Oct 15, 2024 2:06pm UTC)

Merge details

  • The changes were not merged into 11.x.

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
392 392 */
393 393 public function onPostPublish(WorkspacePublishEvent $event): void {
394 394 $this->deleteAssociations($event->getWorkspace()->id());
395
396 // Cleanup sub-workspaces on deploy to Live (no parent) workspace.
397 if (!$event->getWorkspace()->hasParent()) {
  • 392 392 */
    393 393 public function onPostPublish(WorkspacePublishEvent $event): void {
    394 394 $this->deleteAssociations($event->getWorkspace()->id());
    395
    396 // Cleanup sub-workspaces on deploy to Live (no parent) workspace.
    397 if (!$event->getWorkspace()->hasParent()) {
    398 foreach ($event->getPublishedRevisionIds() as $target_entity_type_id => $target_entity_ids) {
  • 158 160 $this->assertWorkspaceAssociations('node', $expected_latest_revisions, $expected_all_revisions, $expected_initial_revisions);
    159 161 }
    160 162
    163 /**
    164 * Tests cleanup of sub-workspaces on publishing to Live.
    165 */
    166 public function testSubWorkspaceCleanupOnPublishToLive(): void {
    167 $workspaceName = 'stage';
    168 $this->switchToWorkspace($workspaceName);
  • 169
    170 // Create and save a node in the 'stage' workspace.
    171 $node = $this->createNode([
    172 'title' => 'Test article - stage - unpublished',
    173 'type' => 'article',
    174 'status' => 0,
    175 ]);
    176 $node->save();
    177
    178 // Simulate the publishing operation.
    179 $node->set('status', 1);
    180 $node->save();
    181
    182 // Create a mock for WorkspaceInterface.
    183 /** @var \Drupal\workspaces\Entity\WorkspaceInterface|MockObject $mockWorkspace */
    184 $mockWorkspace = $this->createMock(WorkspaceInterface::class);
  • added 1 commit

    • 4bf75b90 - Rewrite the fix and the test coverage.

    Compare with previous version

  • added 1 commit

    Compare with previous version

  • closed

  • Please register or sign in to reply
    Loading