Issue #3438769 - Workspace cleanup with test coverage for sub-workspaces.
4 unresolved threads
Closes #3438769
Merge request reports
Activity
Filter activity
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()) { changed this line in version 2 of the diff
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) { changed this line in version 2 of the diff
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); changed this line in version 2 of the diff
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); changed this line in version 2 of the diff
Please register or sign in to reply