public function WorkspaceArchiveTest::testTargetWorkspaceArchive in Deploy - Content Staging 8
Tests archive of a target workspace.
Deployment 1: SalesPromo => Stage (Archived) => Live.
- Both deployments are successful.
Deployment 2: SalesPromo => Stage (Archived)
- Should allow to activate Stage instead of failed deploy.
File
- tests/
src/ Functional/ WorkspaceArchiveTest.php, line 92
Class
- WorkspaceArchiveTest
- Tests workspace archive functionality.
Namespace
Drupal\Tests\deploy\FunctionalCode
public function testTargetWorkspaceArchive() {
$stage = $this
->getOneEntityByLabel('workspace', 'Stage');
$live = $this
->getOneEntityByLabel('workspace', 'Live');
$live
->set('upstream', $stage
->id());
$live
->save();
$sales_promo = $this
->createWorkspaceThroughUI('Sales promo', 'sales_promo');
$sales_promo
->set('upstream', $stage
->id());
$sales_promo
->save();
$this
->switchToWorkspace($sales_promo);
$node = Node::create([
'type' => 'test',
'title' => 'March sales!',
]);
$node
->save();
// 1. Deploy Sales promo to Stage.
$this
->deployThroughUi($sales_promo, $stage);
// 2. Deploy Stage to Live.
$this
->deployThroughUi($stage, $live, [
'archive' => TRUE,
]);
// 3. Switch to 'Sales promo' and deploy new content to Stage.
$this
->switchToWorkspace($sales_promo);
$node = Node::create([
'type' => 'test',
'title' => 'April sales!',
]);
$node
->save();
// 4. Deploy Sales promo to archived Stage.
$this
->drupalGet('admin/structure/deployment/add');
$this
->assertSession()
->pageTextNotContains('Creating new deployments is not allowed at the moment. Contact somebody who has access to Status report page to unblock creating new content deployments.');
$this
->assertSession()
->pageTextContains('Source and target must be set, make sure your current workspace has an upstream.');
}