Skip to content

Commit 0da52b1

Browse files
committed
v1 maintenance release - 1.8.4
1 parent 3579c7e commit 0da52b1

15 files changed

+516
-522
lines changed

__tests__/tools.test.ts

Lines changed: 93 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -2,28 +2,34 @@ import * as tools from '../src/tools';
22

33
describe('Tools tests', () => {
44
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(
99
'Platform fedora is not supported'
1010
);
1111
});
1212

1313
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(
1824
'Platform fedora is not supported'
1925
);
2026
});
2127

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(
2733
'Platform fedora is not supported'
2834
);
2935
});
@@ -107,22 +113,13 @@ describe('Tools tests', () => {
107113
});
108114

109115
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(
111117
'releases/3.2.1/php56/codecept.phar'
112118
);
113-
expect(await tools.getCodeceptionUriBuilder('3.2.1', '7.0', 'php54')).toBe(
119+
expect(await tools.getCodeceptionUriBuilder('3.2.1', 'php54')).toBe(
114120
'releases/3.2.1/php54/codecept.phar'
115121
);
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(
126123
'releases/3.2.1/codecept.phar'
127124
);
128125
});
@@ -146,17 +143,59 @@ describe('Tools tests', () => {
146143
expect(await tools.getCodeceptionUri('latest', '7.4')).toBe(
147144
'codecept.phar'
148145
);
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'
151148
);
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'
154151
);
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'
157166
);
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'
160199
);
161200
});
162201

@@ -173,11 +212,11 @@ describe('Tools tests', () => {
173212
});
174213

175214
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'
178217
);
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'
181220
);
182221
});
183222

@@ -190,7 +229,7 @@ describe('Tools tests', () => {
190229
);
191230
});
192231

193-
it('checking getDeployerUri', async () => {
232+
it('checking addComposer', async () => {
194233
expect(await tools.addComposer(['a', 'b'])).toStrictEqual([
195234
'composer',
196235
'a',
@@ -311,13 +350,13 @@ describe('Tools tests', () => {
311350
'user/',
312351
'linux'
313352
);
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/');
315354

316355
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/');
318357

319358
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/');
321360

322361
script = await tools.addPackage('tool', 'tool:1.2.3', 'user/', 'fedora');
323362
expect(script).toContain('Platform fedora is not supported');
@@ -330,7 +369,7 @@ describe('Tools tests', () => {
330369
'linux'
331370
);
332371
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'
334373
);
335374
expect(script).toContain(
336375
'add_tool https://github.com/staabm/annotate-pull-request-from-checkstyle/releases/latest/download/cs2pr cs2pr'
@@ -351,8 +390,8 @@ describe('Tools tests', () => {
351390
'add_tool https://github.com/symfony/cli/releases/latest/download/symfony_linux_amd64 symfony'
352391
);
353392
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/');
356395
expect(script).toContain('add_devtools');
357396
expect(script).toContain('add_log "$tick" "php-config" "Added"');
358397
expect(script).toContain('add_log "$tick" "phpize" "Added"');
@@ -364,7 +403,7 @@ describe('Tools tests', () => {
364403
'darwin'
365404
);
366405
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'
368407
);
369408
expect(script).toContain(
370409
'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', () => {
384423
expect(script).toContain(
385424
'https://github.com/vimeo/psalm/releases/latest/download/psalm.phar psalm'
386425
);
387-
expect(script).toContain('add_composer_tool phinx phinx robmorgan/');
426+
expect(script).toContain('add_composertool phinx phinx robmorgan/');
388427
expect(script).toContain(
389428
'add_tool https://github.com/phar-io/phive/releases/download/1.2.3/phive-1.2.3.phar phive'
390429
);
391430
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-'
393432
);
394433
expect(script).toContain(
395434
'add_tool https://github.com/symfony/cli/releases/latest/download/symfony_darwin_amd64 symfony'
@@ -407,21 +446,19 @@ describe('Tools tests', () => {
407446
'win32'
408447
);
409448
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'
411450
);
412451
expect(script).toContain(
413452
'Add-Tool https://github.com/staabm/annotate-pull-request-from-checkstyle/releases/latest/download/cs2pr cs2pr'
414453
);
415454
expect(script).toContain(
416455
'Add-Tool https://deployer.org/deployer.phar deployer'
417456
);
418-
expect(script).toContain(
419-
'Add-Composer-Tool prestissimo prestissimo hirak/'
420-
);
457+
expect(script).toContain('Add-Composertool prestissimo prestissimo hirak/');
421458
expect(script).toContain(
422459
'Add-Tool https://github.com/phpmd/phpmd/releases/latest/download/phpmd.phar phpmd'
423460
);
424-
expect(script).toContain('Add-Composer-Tool phinx phinx robmorgan/');
461+
expect(script).toContain('Add-Composertool phinx phinx robmorgan/');
425462
expect(script).toContain(
426463
'Add-Tool https://github.com/phar-io/phive/releases/download/0.13.2/phive-0.13.2.phar phive'
427464
);
@@ -440,14 +477,12 @@ describe('Tools tests', () => {
440477
'win32'
441478
);
442479
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'
447481
);
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/');
449484
expect(script).toContain(
450-
'Add-Composer-Tool composer-prefetcher composer-prefetcher narrowspark/automatic-'
485+
'Add-Composertool composer-prefetcher composer-prefetcher narrowspark/automatic-'
451486
);
452487
});
453488
});

action.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ author: shivammathur
33
description: 'Setup PHP with required extensions, php.ini configuration, code-coverage support and various tools like composer'
44
branding:
55
color: 'purple'
6+
icon: 'play-circle'
67
inputs:
78
php-version:
89
description: 'Setup PHP version.'

0 commit comments

Comments
 (0)