Skip to content

Commit 5a216fc

Browse files
authored
Rename to singular workspace:publish (#6434)
* Rename to singular workspace:publish * Add version attribute
1 parent 9645c40 commit 5a216fc

File tree

2 files changed

+15
-12
lines changed

2 files changed

+15
-12
lines changed

src/Commands/core/WorkspacesCommand.php renamed to src/Commands/core/WorkspacePublishCommand.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,12 @@
1919
description: 'Publish a workspace.'
2020
)]
2121
#[CLI\ValidateModulesEnabled(modules: ['workspaces'])]
22-
final class WorkspacesCommand extends Command
22+
#[CLI\Version(version: '13.7')]
23+
final class WorkspacePublishCommand extends Command
2324
{
2425
use AutowireTrait;
2526

26-
const NAME = 'workspaces:publish';
27+
const NAME = 'workspace:publish';
2728

2829
protected ?WorkspaceOperationFactory $workspacesOperationFactory = null;
2930

@@ -45,7 +46,7 @@ protected function configure()
4546
{
4647
$this
4748
->addArgument('id', InputArgument::REQUIRED, 'The workspace to publish.')
48-
->addUsage('workspaces:publish stage');
49+
->addUsage('workspace:publish stage');
4950
}
5051

5152

tests/integration/WorkspacesTest.php renamed to tests/integration/WorkspaceTest.php

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,22 +6,24 @@
66

77
use Drupal\node\Entity\Node;
88
use Drupal\workspaces\WorkspaceManagerInterface;
9-
use Drush\Commands\core\WorkspacesCommand;
9+
use Drush\Commands\core\WorkspacePublishCommand;
10+
use Drush\Commands\entity\EntityDeleteCommand;
1011
use Drush\Commands\pm\PmInstallCommand;
12+
use Drush\Commands\pm\PmUninstallCommand;
1113

1214
/**
13-
* Tests Workspaces commands
15+
* Tests Workspace commands
1416
*
1517
* @group commands
1618
*/
17-
class WorkspacesTest extends UnishIntegrationTestCase
19+
class WorkspaceTest extends UnishIntegrationTestCase
1820
{
1921
private WorkspaceManagerInterface $workspaceManager;
2022

2123
protected function setUp(): void
2224
{
2325
parent::setUp();
24-
$this->drush(PmInstallCommand::NAME, ['workspaces', 'node']);
26+
$this->drush(PmInstallCommand::NAME, ['workspaces', 'node'], ['yes' => true]);
2527
$this->workspaceManager = \Drupal::service('workspaces.manager');
2628

2729
// Create article content type if it doesn't exist
@@ -65,11 +67,11 @@ public function testWorkspaces(): void
6567
$workspace_id = 'stage';
6668

6769
// Publish the workspace
68-
$this->drush(WorkspacesCommand::NAME, [$workspace_id]);
70+
$this->drush(WorkspacePublishCommand::NAME, [$workspace_id]);
6971
$this->assertStringContainsString('Workspace Stage published', $this->getErrorOutput());
7072

7173
// Verify no more changes exist after publishing
72-
$this->drush(WorkspacesCommand::NAME, [$workspace_id]);
74+
$this->drush(WorkspacePublishCommand::NAME, [$workspace_id]);
7375
$this->assertStringContainsString('There are no changes that can be published', $this->getErrorOutput());
7476
}
7577

@@ -79,9 +81,9 @@ public function testWorkspaces(): void
7981
protected function tearDown(): void
8082
{
8183
// Cleanup the test workspace (this should also handle content deletion)
82-
$this->drush('entity:delete', ['workspace', 'stage'], ['yes' => true]);
83-
$this->drush('entity:delete', ['node'], ['yes' => true, 'bundle' => 'article']);
84-
$this->drush('pm:uninstall', ['workspaces', 'node'], ['yes' => true]);
84+
$this->drush(EntityDeleteCommand::NAME, ['workspace', 'stage'], ['yes' => true]);
85+
$this->drush(EntityDeleteCommand::NAME, ['node'], ['yes' => true, 'bundle' => 'article']);
86+
$this->drush(PmUninstallCommand::NAME, ['workspaces', 'node'], ['yes' => true]);
8587
parent::tearDown();
8688
}
8789
}

0 commit comments

Comments
 (0)