1 | <?php |
||
29 | class TestCase extends \PHPUnit\Framework\TestCase |
||
30 | { |
||
31 | /** |
||
32 | * @var \GitElephant\Command\Caller\CallerInterface |
||
33 | */ |
||
34 | protected $caller; |
||
35 | |||
36 | /** |
||
37 | * @var Repository |
||
38 | */ |
||
39 | protected $repository; |
||
40 | |||
41 | /** |
||
42 | * @var string |
||
43 | */ |
||
44 | protected $path; |
||
45 | |||
46 | /** |
||
47 | * @var Finder |
||
48 | */ |
||
49 | protected $finder; |
||
50 | |||
51 | /** |
||
52 | * @param null $name |
||
53 | * |
||
54 | * @return \GitElephant\Repository |
||
55 | */ |
||
56 | protected function getRepository($name = null) |
||
67 | |||
68 | /** |
||
69 | * @return \GitElephant\Command\Caller\Caller |
||
70 | */ |
||
71 | protected function getCaller() |
||
79 | |||
80 | /** |
||
81 | * @param null|string $name the folder name |
||
82 | * @param int $index the repository index (for getting them back) |
||
83 | * |
||
84 | * @return void |
||
85 | */ |
||
86 | protected function initRepository($name = null, $index = null) |
||
106 | |||
107 | protected function tearDown() |
||
119 | |||
120 | /** |
||
121 | * @param string $name file name |
||
122 | * @param string|null $folder folder name |
||
123 | * @param null $content content |
||
124 | * @param Repository $repository repository to add file to |
||
125 | * |
||
126 | * @return void |
||
127 | */ |
||
128 | protected function addFile($name, $folder = null, $content = null, $repository = null) |
||
143 | |||
144 | /** |
||
145 | * remove file from repo |
||
146 | * |
||
147 | * @param string $name |
||
148 | */ |
||
149 | protected function removeFile($name) |
||
154 | |||
155 | /** |
||
156 | * update a file in the repository |
||
157 | * |
||
158 | * @param string $name file name |
||
159 | * @param string $content content |
||
160 | */ |
||
161 | protected function updateFile($name, $content) |
||
166 | |||
167 | /** |
||
168 | * rename a file in the repository |
||
169 | * |
||
170 | * @param string $originName file name |
||
171 | * @param string $targetName new file name |
||
172 | * @param bool $gitMv use git mv, otherwise uses php rename function (with the Filesystem component) |
||
173 | */ |
||
174 | protected function renameFile($originName, $targetName, $gitMv = true) |
||
186 | |||
187 | /** |
||
188 | * @param string $name name |
||
189 | * |
||
190 | * @return void |
||
191 | */ |
||
192 | protected function addFolder($name) |
||
197 | |||
198 | protected function addSubmodule($url, $path) |
||
202 | |||
203 | /** |
||
204 | * @param $classname |
||
205 | * |
||
206 | * @return \PHPUnit\Framework\MockObject\MockObject |
||
207 | */ |
||
208 | protected function getMock($classname) |
||
215 | |||
216 | /** |
||
217 | * mock the caller |
||
218 | * |
||
219 | * @param string $command command |
||
220 | * @param string $output output |
||
221 | * |
||
222 | * @return \PHPUnit\Framework\MockObject\MockObject |
||
223 | */ |
||
224 | protected function getMockCaller($command, $output) |
||
238 | |||
239 | protected function getMockContainer() |
||
243 | |||
244 | protected function addCommandToMockContainer(\PHPUnit\Framework\MockObject\MockObject $container, $commandName) |
||
252 | |||
253 | protected function addOutputToMockRepo(\PHPUnit\Framework\MockObject\MockObject $repo, $output) |
||
260 | |||
261 | protected function getMockCommand() |
||
271 | |||
272 | protected function getMockRepository() |
||
283 | |||
284 | protected function doCommitTest( |
||
311 | } |
||
312 |
If you suppress an error, we recommend checking for the error condition explicitly: