-
Notifications
You must be signed in to change notification settings - Fork 31
Expand file tree
/
Copy pathWorkspaceDeleteCommandTest.php
More file actions
67 lines (51 loc) · 1.97 KB
/
WorkspaceDeleteCommandTest.php
File metadata and controls
67 lines (51 loc) · 1.97 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
<?php
declare(strict_types=1);
namespace PHPCR\Tests\Util\Console\Command;
use PHPCR\RepositoryInterface;
use PHPCR\Util\Console\Command\WorkspaceDeleteCommand;
class WorkspaceDeleteCommandTest extends BaseCommandTest
{
public function setUp(): void
{
parent::setUp();
$this->addCommand(new WorkspaceDeleteCommand());
}
public function testDelete(): void
{
$this->session->expects($this->once())
->method('getWorkspace')
->willReturn($this->workspace);
$this->workspace->expects($this->once())
->method('getAccessibleWorkspaceNames')
->willReturn(['default', 'test_workspace', 'other']);
$this->session->expects($this->once())
->method('getRepository')
->willReturn($this->repository);
$this->repository->expects($this->once())
->method('getDescriptor')
->with(RepositoryInterface::OPTION_WORKSPACE_MANAGEMENT_SUPPORTED)
->willReturn(true);
$this->workspace->expects($this->once())
->method('deleteWorkspace')
->with('test_workspace');
$ct = $this->executeCommand('phpcr:workspace:delete', [
'name' => 'test_workspace',
'--force' => 'true',
]);
$this->assertStringContainsString("Deleted workspace 'test_workspace'.", $ct->getDisplay());
}
public function testDeleteNonexistent(): void
{
$this->session->expects($this->once())
->method('getWorkspace')
->willReturn($this->workspace);
$this->workspace->expects($this->once())
->method('getAccessibleWorkspaceNames')
->willReturn(['default', 'other']);
$ct = $this->executeCommand('phpcr:workspace:delete', [
'name' => 'test_workspace',
'--force' => 'true',
]);
$this->assertStringContainsString("Workspace 'test_workspace' does not exist.", $ct->getDisplay());
}
}