@@ -2,28 +2,34 @@ import * as tools from '../src/tools';
2
2
3
3
describe ( 'Tools tests' , ( ) => {
4
4
it ( 'checking getCommand' , async ( ) => {
5
- expect ( await tools . getArchiveCommand ( 'linux' ) ) . toBe ( 'add_tool ' ) ;
6
- expect ( await tools . getArchiveCommand ( 'darwin' ) ) . toBe ( 'add_tool ' ) ;
7
- expect ( await tools . getArchiveCommand ( 'win32' ) ) . toBe ( 'Add-Tool ' ) ;
8
- expect ( await tools . getArchiveCommand ( 'fedora' ) ) . toContain (
5
+ expect ( await tools . getCommand ( 'linux' , 'tool ') ) . toBe ( 'add_tool ' ) ;
6
+ expect ( await tools . getCommand ( 'darwin' , 'tool ') ) . toBe ( 'add_tool ' ) ;
7
+ expect ( await tools . getCommand ( 'win32' , 'tool ') ) . toBe ( 'Add-Tool ' ) ;
8
+ expect ( await tools . getCommand ( 'fedora' , 'tool ') ) . toContain (
9
9
'Platform fedora is not supported'
10
10
) ;
11
11
} ) ;
12
12
13
13
it ( 'checking getCommand' , async ( ) => {
14
- expect ( await tools . getPackageCommand ( 'linux' ) ) . toBe ( 'add_composer_tool ' ) ;
15
- expect ( await tools . getPackageCommand ( 'darwin' ) ) . toBe ( 'add_composer_tool ' ) ;
16
- expect ( await tools . getPackageCommand ( 'win32' ) ) . toBe ( 'Add-Composer-Tool ' ) ;
17
- expect ( await tools . getPackageCommand ( 'fedora' ) ) . toContain (
14
+ expect ( await tools . getCommand ( 'linux' , 'composertool' ) ) . toBe (
15
+ 'add_composertool '
16
+ ) ;
17
+ expect ( await tools . getCommand ( 'darwin' , 'composertool' ) ) . toBe (
18
+ 'add_composertool '
19
+ ) ;
20
+ expect ( await tools . getCommand ( 'win32' , 'composertool' ) ) . toBe (
21
+ 'Add-Composertool '
22
+ ) ;
23
+ expect ( await tools . getCommand ( 'fedora' , 'composertool' ) ) . toContain (
18
24
'Platform fedora is not supported'
19
25
) ;
20
26
} ) ;
21
27
22
- it ( 'checking getPECLCommand ' , async ( ) => {
23
- expect ( await tools . getPECLCommand ( 'linux' ) ) . toBe ( 'add_pecl ' ) ;
24
- expect ( await tools . getPECLCommand ( 'darwin' ) ) . toBe ( 'add_pecl ' ) ;
25
- expect ( await tools . getPECLCommand ( 'win32' ) ) . toBe ( 'Add-PECL ' ) ;
26
- expect ( await tools . getPECLCommand ( 'fedora' ) ) . toContain (
28
+ it ( 'checking getCommand ' , async ( ) => {
29
+ expect ( await tools . getCommand ( 'linux' , 'pecl ') ) . toBe ( 'add_pecl ' ) ;
30
+ expect ( await tools . getCommand ( 'darwin' , 'pecl ') ) . toBe ( 'add_pecl ' ) ;
31
+ expect ( await tools . getCommand ( 'win32' , 'pecl' ) ) . toBe ( 'Add-Pecl ' ) ;
32
+ expect ( await tools . getCommand ( 'fedora' , 'pecl ') ) . toContain (
27
33
'Platform fedora is not supported'
28
34
) ;
29
35
} ) ;
@@ -107,22 +113,13 @@ describe('Tools tests', () => {
107
113
} ) ;
108
114
109
115
it ( 'checking getCodeceptionUriBuilder' , async ( ) => {
110
- expect ( await tools . getCodeceptionUriBuilder ( '3.2.1' , '5.6' , ' php56') ) . toBe (
116
+ expect ( await tools . getCodeceptionUriBuilder ( '3.2.1' , 'php56' ) ) . toBe (
111
117
'releases/3.2.1/php56/codecept.phar'
112
118
) ;
113
- expect ( await tools . getCodeceptionUriBuilder ( '3.2.1' , '7.0' , ' php54') ) . toBe (
119
+ expect ( await tools . getCodeceptionUriBuilder ( '3.2.1' , 'php54' ) ) . toBe (
114
120
'releases/3.2.1/php54/codecept.phar'
115
121
) ;
116
- expect ( await tools . getCodeceptionUriBuilder ( '3.2.1' , '7.1' , 'php56' ) ) . toBe (
117
- 'releases/3.2.1/php56/codecept.phar'
118
- ) ;
119
- expect ( await tools . getCodeceptionUriBuilder ( '3.2.1' , '7.2' , 'php56' ) ) . toBe (
120
- 'releases/3.2.1/codecept.phar'
121
- ) ;
122
- expect ( await tools . getCodeceptionUriBuilder ( '3.2.1' , '7.3' , 'php56' ) ) . toBe (
123
- 'releases/3.2.1/codecept.phar'
124
- ) ;
125
- expect ( await tools . getCodeceptionUriBuilder ( '3.2.1' , '7.4' , 'php56' ) ) . toBe (
122
+ expect ( await tools . getCodeceptionUriBuilder ( '3.2.1' , '' ) ) . toBe (
126
123
'releases/3.2.1/codecept.phar'
127
124
) ;
128
125
} ) ;
@@ -146,17 +143,59 @@ describe('Tools tests', () => {
146
143
expect ( await tools . getCodeceptionUri ( 'latest' , '7.4' ) ) . toBe (
147
144
'codecept.phar'
148
145
) ;
149
- expect ( await tools . getCodeceptionUri ( '3.2.1 ' , '5.6 ' ) ) . toBe (
150
- 'releases/3.2.1/php54 /codecept.phar'
146
+ expect ( await tools . getCodeceptionUri ( '4.0.0 ' , '7.4 ' ) ) . toBe (
147
+ 'releases/4.0.0 /codecept.phar'
151
148
) ;
152
- expect ( await tools . getCodeceptionUri ( '4.3.2 ' , '5.6' ) ) . toBe (
153
- 'releases/4.3.2 /php56/codecept.phar'
149
+ expect ( await tools . getCodeceptionUri ( '4.0.0 ' , '5.6' ) ) . toBe (
150
+ 'releases/4.0.0 /php56/codecept.phar'
154
151
) ;
155
- expect ( await tools . getCodeceptionUri ( '3.2.1' , '7.4' ) ) . toBe (
156
- 'releases/3.2.1/codecept.phar'
152
+ expect ( await tools . getCodeceptionUri ( '4.0.0' , '7.1' ) ) . toBe (
153
+ 'releases/4.0.0/php56/codecept.phar'
154
+ ) ;
155
+ expect ( await tools . getCodeceptionUri ( '3.1.0' , '7.4' ) ) . toBe (
156
+ 'releases/3.1.0/codecept.phar'
157
+ ) ;
158
+ expect ( await tools . getCodeceptionUri ( '3.1.0' , '5.6' ) ) . toBe (
159
+ 'releases/3.1.0/php54/codecept.phar'
160
+ ) ;
161
+ expect ( await tools . getCodeceptionUri ( '2.5.4' , '7.4' ) ) . toBe (
162
+ 'releases/2.5.4/codecept.phar'
163
+ ) ;
164
+ expect ( await tools . getCodeceptionUri ( '2.5.4' , '5.6' ) ) . toBe (
165
+ 'releases/2.5.4/php54/codecept.phar'
157
166
) ;
158
- expect ( await tools . getCodeceptionUri ( '4.3.2' , '7.4' ) ) . toBe (
159
- 'releases/4.3.2/codecept.phar'
167
+ expect ( await tools . getCodeceptionUri ( '2.3.4' , '7.4' ) ) . toBe (
168
+ 'releases/2.3.4/codecept.phar'
169
+ ) ;
170
+ expect ( await tools . getCodeceptionUri ( '2.3.4' , '5.4' ) ) . toBe (
171
+ 'releases/2.3.4/php54/codecept.phar'
172
+ ) ;
173
+ expect ( await tools . getCodeceptionUri ( '2.2.4' , '5.6' ) ) . toBe (
174
+ 'releases/2.2.4/codecept.phar'
175
+ ) ;
176
+ expect ( await tools . getCodeceptionUri ( '2.2.4' , '7.4' ) ) . toBe (
177
+ 'releases/2.2.4/codecept.phar'
178
+ ) ;
179
+ expect ( await tools . getCodeceptionUri ( '2.2.4' , '5.4' ) ) . toBe (
180
+ 'releases/2.2.4/php54/codecept.phar'
181
+ ) ;
182
+ expect ( await tools . getCodeceptionUri ( '2.1.7' , '5.6' ) ) . toBe (
183
+ 'releases/2.1.7/codecept.phar'
184
+ ) ;
185
+ expect ( await tools . getCodeceptionUri ( '2.1.7' , '5.4' ) ) . toBe (
186
+ 'releases/2.1.7/php54/codecept.phar'
187
+ ) ;
188
+ expect ( await tools . getCodeceptionUri ( '2.1.5' , '5.4' ) ) . toBe (
189
+ 'releases/2.1.5/codecept.phar'
190
+ ) ;
191
+ expect ( await tools . getCodeceptionUri ( '2.1.5' , '7.4' ) ) . toBe (
192
+ 'releases/2.1.5/codecept.phar'
193
+ ) ;
194
+ expect ( await tools . getCodeceptionUri ( '1.6.9' , '7.4' ) ) . toBe (
195
+ 'releases/1.6.9/codecept.phar'
196
+ ) ;
197
+ expect ( await tools . getCodeceptionUri ( '1.5.0' , '7.4' ) ) . toBe (
198
+ 'releases/1.5.0/codecept.phar'
160
199
) ;
161
200
} ) ;
162
201
@@ -173,11 +212,11 @@ describe('Tools tests', () => {
173
212
} ) ;
174
213
175
214
it ( 'checking getPhpunitUri' , async ( ) => {
176
- expect ( await tools . getPhpunitUrl ( ' tool', 'latest' ) ) . toBe (
177
- 'https://phar.phpunit.de /tool.phar'
215
+ expect ( await tools . getPharUrl ( 'domain' , ' tool' , ' ', 'latest' ) ) . toBe (
216
+ 'domain /tool.phar'
178
217
) ;
179
- expect ( await tools . getPhpunitUrl ( ' tool', '1.2.3' ) ) . toBe (
180
- 'https://phar.phpunit.de/ tool-1 .2.3.phar'
218
+ expect ( await tools . getPharUrl ( 'domain' , ' tool' , 'v ', '1.2.3' ) ) . toBe (
219
+ 'domain/ tool-v1 .2.3.phar'
181
220
) ;
182
221
} ) ;
183
222
@@ -190,7 +229,7 @@ describe('Tools tests', () => {
190
229
) ;
191
230
} ) ;
192
231
193
- it ( 'checking getDeployerUri ' , async ( ) => {
232
+ it ( 'checking addComposer ' , async ( ) => {
194
233
expect ( await tools . addComposer ( [ 'a' , 'b' ] ) ) . toStrictEqual ( [
195
234
'composer' ,
196
235
'a' ,
@@ -311,13 +350,13 @@ describe('Tools tests', () => {
311
350
'user/' ,
312
351
'linux'
313
352
) ;
314
- expect ( script ) . toContain ( 'add_composer_tool tool tool:1.2.3 user/' ) ;
353
+ expect ( script ) . toContain ( 'add_composertool tool tool:1.2.3 user/' ) ;
315
354
316
355
script = await tools . addPackage ( 'tool' , 'tool:1.2.3' , 'user/' , 'darwin' ) ;
317
- expect ( script ) . toContain ( 'add_composer_tool tool tool:1.2.3 user/' ) ;
356
+ expect ( script ) . toContain ( 'add_composertool tool tool:1.2.3 user/' ) ;
318
357
319
358
script = await tools . addPackage ( 'tool' , 'tool:1.2.3' , 'user/' , 'win32' ) ;
320
- expect ( script ) . toContain ( 'Add-Composer-Tool tool tool:1.2.3 user/' ) ;
359
+ expect ( script ) . toContain ( 'Add-Composertool tool tool:1.2.3 user/' ) ;
321
360
322
361
script = await tools . addPackage ( 'tool' , 'tool:1.2.3' , 'user/' , 'fedora' ) ;
323
362
expect ( script ) . toContain ( 'Platform fedora is not supported' ) ;
@@ -330,7 +369,7 @@ describe('Tools tests', () => {
330
369
'linux'
331
370
) ;
332
371
expect ( script ) . toContain (
333
- 'add_tool https://github.com /composer/composer/releases/latest/download/composer .phar composer'
372
+ 'add_tool https://getcomposer.org /composer-stable .phar composer'
334
373
) ;
335
374
expect ( script ) . toContain (
336
375
'add_tool https://github.com/staabm/annotate-pull-request-from-checkstyle/releases/latest/download/cs2pr cs2pr'
@@ -351,8 +390,8 @@ describe('Tools tests', () => {
351
390
'add_tool https://github.com/symfony/cli/releases/latest/download/symfony_linux_amd64 symfony'
352
391
) ;
353
392
expect ( script ) . toContain ( 'add_pecl' ) ;
354
- expect ( script ) . toContain ( 'add_composer_tool phinx phinx robmorgan/' ) ;
355
- expect ( script ) . toContain ( 'add_composer_tool phinx phinx:1.2.3 robmorgan/' ) ;
393
+ expect ( script ) . toContain ( 'add_composertool phinx phinx robmorgan/' ) ;
394
+ expect ( script ) . toContain ( 'add_composertool phinx phinx:1.2.3 robmorgan/' ) ;
356
395
expect ( script ) . toContain ( 'add_devtools' ) ;
357
396
expect ( script ) . toContain ( 'add_log "$tick" "php-config" "Added"' ) ;
358
397
expect ( script ) . toContain ( 'add_log "$tick" "phpize" "Added"' ) ;
@@ -364,7 +403,7 @@ describe('Tools tests', () => {
364
403
'darwin'
365
404
) ;
366
405
expect ( script ) . toContain (
367
- 'add_tool https://github.com /composer/composer/releases/latest/download/composer .phar composer'
406
+ 'add_tool https://getcomposer.org /composer-stable .phar composer'
368
407
) ;
369
408
expect ( script ) . toContain (
370
409
'add_tool https://github.com/staabm/annotate-pull-request-from-checkstyle/releases/download/1.2.3/cs2pr cs2pr'
@@ -384,12 +423,12 @@ describe('Tools tests', () => {
384
423
expect ( script ) . toContain (
385
424
'https://github.com/vimeo/psalm/releases/latest/download/psalm.phar psalm'
386
425
) ;
387
- expect ( script ) . toContain ( 'add_composer_tool phinx phinx robmorgan/' ) ;
426
+ expect ( script ) . toContain ( 'add_composertool phinx phinx robmorgan/' ) ;
388
427
expect ( script ) . toContain (
389
428
'add_tool https://github.com/phar-io/phive/releases/download/1.2.3/phive-1.2.3.phar phive'
390
429
) ;
391
430
expect ( script ) . toContain (
392
- 'add_composer_tool composer-prefetcher composer-prefetcher:1.2.3 narrowspark/automatic-'
431
+ 'add_composertool composer-prefetcher composer-prefetcher:1.2.3 narrowspark/automatic-'
393
432
) ;
394
433
expect ( script ) . toContain (
395
434
'add_tool https://github.com/symfony/cli/releases/latest/download/symfony_darwin_amd64 symfony'
@@ -407,21 +446,19 @@ describe('Tools tests', () => {
407
446
'win32'
408
447
) ;
409
448
expect ( script ) . toContain (
410
- 'Add-Tool https://github.com /composer/composer/releases/latest/download/composer .phar composer'
449
+ 'Add-Tool https://getcomposer.org /composer-stable .phar composer'
411
450
) ;
412
451
expect ( script ) . toContain (
413
452
'Add-Tool https://github.com/staabm/annotate-pull-request-from-checkstyle/releases/latest/download/cs2pr cs2pr'
414
453
) ;
415
454
expect ( script ) . toContain (
416
455
'Add-Tool https://deployer.org/deployer.phar deployer'
417
456
) ;
418
- expect ( script ) . toContain (
419
- 'Add-Composer-Tool prestissimo prestissimo hirak/'
420
- ) ;
457
+ expect ( script ) . toContain ( 'Add-Composertool prestissimo prestissimo hirak/' ) ;
421
458
expect ( script ) . toContain (
422
459
'Add-Tool https://github.com/phpmd/phpmd/releases/latest/download/phpmd.phar phpmd'
423
460
) ;
424
- expect ( script ) . toContain ( 'Add-Composer-Tool phinx phinx robmorgan/' ) ;
461
+ expect ( script ) . toContain ( 'Add-Composertool phinx phinx robmorgan/' ) ;
425
462
expect ( script ) . toContain (
426
463
'Add-Tool https://github.com/phar-io/phive/releases/download/0.13.2/phive-0.13.2.phar phive'
427
464
) ;
@@ -440,14 +477,12 @@ describe('Tools tests', () => {
440
477
'win32'
441
478
) ;
442
479
expect ( script ) . toContain (
443
- 'Add-Tool https://github.com/composer/composer/releases/latest/download/composer.phar composer'
444
- ) ;
445
- expect ( script ) . toContain (
446
- 'Add-Composer-Tool prestissimo prestissimo hirak/'
480
+ 'Add-Tool https://getcomposer.org/composer-stable.phar composer'
447
481
) ;
448
- expect ( script ) . toContain ( 'Add-Composer-Tool phinx phinx robmorgan/' ) ;
482
+ expect ( script ) . toContain ( 'Add-Composertool prestissimo prestissimo hirak/' ) ;
483
+ expect ( script ) . toContain ( 'Add-Composertool phinx phinx robmorgan/' ) ;
449
484
expect ( script ) . toContain (
450
- 'Add-Composer-Tool composer-prefetcher composer-prefetcher narrowspark/automatic-'
485
+ 'Add-Composertool composer-prefetcher composer-prefetcher narrowspark/automatic-'
451
486
) ;
452
487
} ) ;
453
488
} ) ;
0 commit comments