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