Further Drupal 8.6.4 changes. Some core files were not committed before a commit...
[yaffs-website] / vendor / drush / drush / isolation / tests / ArgsPreprocessorTest.php
1 <?php
2 namespace Drush\Preflight;
3
4 use PHPUnit\Framework\TestCase;
5
6 class ArgsPreprocessorTest extends TestCase
7 {
8
9     use \Drush\FixtureFactory;
10
11     /**
12      * @dataProvider argTestValues
13      */
14     public function testArgPreprocessor(
15         $argv,
16         $alias,
17         $selectedSite,
18         $configPath,
19         $aliasPath,
20         $commandPath,
21         $isLocal,
22         $unprocessedArgs)
23     {
24
25         $argProcessor = new ArgsPreprocessor();
26         $preflightArgs = new PreflightArgs();
27         $preflightArgs->setHomeDir($this->environment()->homeDir());
28         $argProcessor->parse($argv, $preflightArgs);
29
30         $this->assertEquals($unprocessedArgs, implode(',', $preflightArgs->args()));
31         $this->assertEquals($alias, $preflightArgs->alias());
32         $this->assertEquals($selectedSite, $preflightArgs->selectedSite());
33         $this->assertEquals($configPath, $preflightArgs->configPaths());
34         $this->assertEquals($aliasPath, $preflightArgs->aliasPaths());
35     }
36
37     public static function argTestValues()
38     {
39         return [
40             [
41                 [
42                     'drush',
43                     '@alias',
44                     'status',
45                     'version',
46                 ],
47
48                 '@alias',
49                 null,
50                 [],
51                 [],
52                 [],
53                 null,
54                 'drush,status,version',
55             ],
56
57             [
58                 [
59                     'drush',
60                     '#multisite',
61                     'status',
62                     'version',
63                 ],
64
65                 '#multisite',
66                 null,
67                 [],
68                 [],
69                 [],
70                 null,
71                 'drush,status,version',
72             ],
73
74             [
75                 [
76                     'drush',
77                     'user@server/path',
78                     'status',
79                     'version',
80                 ],
81
82                 'user@server/path',
83                 null,
84                 [],
85                 [],
86                 [],
87                 null,
88                 'drush,status,version',
89             ],
90
91             [
92                 [
93                     'drush',
94                     'rsync',
95                     '@from',
96                     '@to',
97                     '--delete',
98                 ],
99
100                 null,
101                 null,
102                 [],
103                 [],
104                 [],
105                 null,
106                 'drush,rsync,@from,@to,--delete',
107             ],
108
109             [
110                 [
111                     'drush',
112                     '--root',
113                     '/path/to/drupal',
114                     'status',
115                     '--verbose',
116                 ],
117
118                 null,
119                 '/path/to/drupal',
120                 [],
121                 [],
122                 [],
123                 null,
124                 'drush,status,--verbose',
125             ],
126
127             [
128                 [
129                     'drush',
130                     '--root=/path/to/drupal',
131                     'status',
132                     '--verbose',
133                 ],
134
135                 null,
136                 '/path/to/drupal',
137                 [],
138                 [],
139                 [],
140                 null,
141                 'drush,status,--verbose',
142             ],
143
144             [
145                 [
146                     'drush',
147                     'status',
148                     '--verbose',
149                     '--config',
150                     '/path/to/config',
151                 ],
152
153                 null,
154                 null,
155                 ['/path/to/config'],
156                 [],
157                 [],
158                 null,
159                 'drush,status,--verbose',
160             ],
161
162             [
163                 [
164                     'drush',
165                     'status',
166                     '--verbose',
167                     '--config=/path/to/config',
168                 ],
169
170                 null,
171                 null,
172                 ['/path/to/config'],
173                 [],
174                 [],
175                 null,
176                 'drush,status,--verbose',
177             ],
178
179             [
180                 [
181                     'drush',
182                     'status',
183                     '--verbose',
184                     '--config=/path/to/config',
185                     '--config=/other/path/to/config',
186                 ],
187
188                 null,
189                 null,
190                 ['/path/to/config','/other/path/to/config'],
191                 [],
192                 [],
193                 null,
194                 'drush,status,--verbose',
195             ],
196
197             [
198                 [
199                     'drush',
200                     'status',
201                     '--verbose',
202                     '--alias-path',
203                     '/path/to/aliases',
204                 ],
205
206                 null,
207                 null,
208                 [],
209                 ['/path/to/aliases'],
210                 [],
211                 null,
212                 'drush,status,--verbose',
213             ],
214
215             [
216                 [
217                     'drush',
218                     'status',
219                     '--verbose',
220                     '--alias-path=/path/to/aliases',
221                 ],
222
223                 null,
224                 null,
225                 [],
226                 ['/path/to/aliases'],
227                 [],
228                 null,
229                 'drush,status,--verbose',
230             ],
231
232             [
233                 [
234                     'drush',
235                     'status',
236                     '--verbose',
237                     '--alias-path=/path/to/aliases',
238                     '--alias-path=/other/path/to/aliases',
239                 ],
240
241                 null,
242                 null,
243                 [],
244                 ['/path/to/aliases','/other/path/to/aliases'],
245                 [],
246                 null,
247                 'drush,status,--verbose',
248             ],
249
250             [
251                 [
252                     'drush',
253                     'status',
254                     '--verbose',
255                     '--include',
256                     '/path/to/commands',
257                 ],
258
259                 null,
260                 null,
261                 [],
262                 [],
263                 ['path/to/commands'],
264                 null,
265                 'drush,status,--verbose',
266             ],
267
268             [
269                 [
270                     'drush',
271                     'status',
272                     '--verbose',
273                     '--include=/path/to/commands',
274                 ],
275
276                 null,
277                 null,
278                 [],
279                 [],
280                 ['path/to/commands'],
281                 null,
282                 'drush,status,--verbose',
283             ],
284
285             [
286                 [
287                     'drush',
288                     'status',
289                     '--verbose',
290                     '--include=/path/to/commands',
291                 ],
292
293                 null,
294                 null,
295                 [],
296                 [],
297                 ['path/to/commands'],
298                 null,
299                 'drush,status,--verbose',
300             ],
301
302             [
303                 [
304                     'drush',
305                     'status',
306                     '--verbose',
307                     '--include=/path/to/commands',
308                     '--include=/other/path/to/commands',
309                 ],
310
311                 null,
312                 null,
313                 [],
314                 [],
315                 ['path/to/commands','/other/path/to/commands'],
316                 null,
317                 'drush,status,--verbose',
318             ],
319
320             [
321                 [
322                     'drush',
323                     'status',
324                     '--verbose',
325                     '--local',
326                 ],
327
328                 null,
329                 null,
330                 [],
331                 [],
332                 [],
333                 true,
334                 'drush,status,--verbose',
335             ],
336
337             [
338                 [
339                     'drush',
340                     '@alias',
341                     'status',
342                     '--verbose',
343                     '--local',
344                     '--alias-path=/path/to/aliases',
345                     '--config=/path/to/config',
346                     '--root=/path/to/drupal',
347                     '--include=/path/to/commands',
348                 ],
349
350                 '@alias',
351                 '/path/to/drupal',
352                 ['/path/to/config'],
353                 ['/path/to/aliases'],
354                 ['path/to/commands'],
355                 true,
356                 'drush,status,--verbose',
357             ],
358         ];
359     }
360 }