1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* User: matteo |
5
|
|
|
* Date: 06/06/13 |
6
|
|
|
* Time: 23.45 |
7
|
|
|
* Just for fun... |
8
|
|
|
*/ |
9
|
|
|
|
10
|
|
|
namespace GitElephant\Command; |
11
|
|
|
|
12
|
|
|
use GitElephant\TestCase; |
13
|
|
|
|
14
|
|
|
/** |
15
|
|
|
* Class StashCommandTest |
16
|
|
|
* |
17
|
|
|
* @package GitElephant\Command |
18
|
|
|
*/ |
19
|
|
|
class StashCommandTest extends TestCase |
20
|
|
|
{ |
21
|
|
|
/** |
22
|
|
|
* testSave |
23
|
|
|
*/ |
24
|
|
|
public function testSave(): void |
25
|
|
|
{ |
26
|
|
|
$command = StashCommand::getInstance(); |
27
|
|
|
$this->assertEquals("stash save 'Test'", $command->save('Test')); |
28
|
|
|
$this->assertEquals( |
29
|
|
|
"stash save '--include-untracked' '--keep-index' 'Test'", |
30
|
|
|
$command->save('Test', true, true) |
31
|
|
|
); |
32
|
|
|
} |
33
|
|
|
|
34
|
|
|
/** |
35
|
|
|
* testList |
36
|
|
|
*/ |
37
|
|
|
public function testList(): void |
38
|
|
|
{ |
39
|
|
|
$command = StashCommand::getInstance(); |
40
|
|
|
$this->assertEquals("stash list", $command->listStashes()); |
41
|
|
|
$this->assertEquals("stash list '-p'", $command->listStashes(['-p'])); |
42
|
|
|
} |
43
|
|
|
|
44
|
|
|
/** |
45
|
|
|
* testShow |
46
|
|
|
*/ |
47
|
|
|
public function testShow(): void |
48
|
|
|
{ |
49
|
|
|
$command = StashCommand::getInstance(); |
50
|
|
|
$this->assertEquals("stash show 'stash@{0}'", $command->show(0)); |
51
|
|
|
} |
52
|
|
|
|
53
|
|
|
/** |
54
|
|
|
* testDrop |
55
|
|
|
*/ |
56
|
|
|
public function testDrop(): void |
57
|
|
|
{ |
58
|
|
|
$command = StashCommand::getInstance(); |
59
|
|
|
$this->assertEquals("stash drop 'stash@{0}'", $command->drop(0)); |
60
|
|
|
} |
61
|
|
|
|
62
|
|
|
/** |
63
|
|
|
* testApply |
64
|
|
|
*/ |
65
|
|
|
public function testApply(): void |
66
|
|
|
{ |
67
|
|
|
$command = StashCommand::getInstance(); |
68
|
|
|
$this->assertEquals("stash apply 'stash@{0}'", $command->apply(0)); |
69
|
|
|
$this->assertEquals("stash apply '--index' 'stash@{0}'", $command->apply(0, true)); |
70
|
|
|
} |
71
|
|
|
|
72
|
|
|
/** |
73
|
|
|
* testPop |
74
|
|
|
*/ |
75
|
|
|
public function testPop(): void |
76
|
|
|
{ |
77
|
|
|
$command = StashCommand::getInstance(); |
78
|
|
|
$this->assertEquals("stash pop 'stash@{0}'", $command->pop(0)); |
79
|
|
|
$this->assertEquals("stash pop '--index' 'stash@{0}'", $command->pop(0, true)); |
80
|
|
|
} |
81
|
|
|
|
82
|
|
|
/** |
83
|
|
|
* testBranch |
84
|
|
|
*/ |
85
|
|
|
public function testBranch(): void |
86
|
|
|
{ |
87
|
|
|
$command = StashCommand::getInstance(); |
88
|
|
|
$this->assertEquals("stash branch 'testbranch' 'stash@{0}'", $command->branch('testbranch', 0)); |
89
|
|
|
} |
90
|
|
|
|
91
|
|
|
/** |
92
|
|
|
* testClear |
93
|
|
|
*/ |
94
|
|
|
public function testClear(): void |
95
|
|
|
{ |
96
|
|
|
$command = StashCommand::getInstance(); |
97
|
|
|
$this->assertEquals("stash clear", $command->clear()); |
98
|
|
|
} |
99
|
|
|
|
100
|
|
|
/** |
101
|
|
|
* testCreate |
102
|
|
|
*/ |
103
|
|
|
public function testCreate(): void |
104
|
|
|
{ |
105
|
|
|
$command = StashCommand::getInstance(); |
106
|
|
|
$this->assertEquals("stash create", $command->create()); |
107
|
|
|
} |
108
|
|
|
} |
109
|
|
|
|