setup-php 2.12.0 → 2.16.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (113) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +977 -936
  3. package/package.json +66 -56
  4. package/src/config.ts +82 -82
  5. package/src/configs/brew_extensions +30 -0
  6. package/src/configs/os_releases.csv +17 -0
  7. package/src/configs/php-versions.json +6 -5
  8. package/src/configs/{php.json → pm/php.json} +29 -29
  9. package/src/configs/{phpunit.json → pm/phpunit.json} +24 -24
  10. package/src/configs/tools.json +256 -234
  11. package/src/configs/tools_schema.json +114 -103
  12. package/src/coverage.ts +169 -142
  13. package/src/extensions.ts +363 -349
  14. package/src/install.ts +79 -82
  15. package/src/scripts/common.sh +366 -314
  16. package/src/scripts/darwin.sh +257 -248
  17. package/src/scripts/ext/blackfire.ps1 +32 -32
  18. package/src/scripts/ext/blackfire.sh +22 -21
  19. package/src/scripts/ext/couchbase.sh +43 -43
  20. package/src/scripts/ext/cubrid.sh +60 -60
  21. package/src/scripts/ext/extension_map.php +109 -0
  22. package/src/scripts/ext/firebird.ps1 +19 -19
  23. package/src/scripts/ext/firebird.sh +39 -35
  24. package/src/scripts/ext/gearman.sh +22 -22
  25. package/src/scripts/ext/geos.sh +17 -17
  26. package/src/scripts/ext/http.ps1 +54 -54
  27. package/src/scripts/ext/http.sh +120 -120
  28. package/src/scripts/ext/intl.sh +23 -23
  29. package/src/scripts/ext/ioncube.ps1 +33 -32
  30. package/src/scripts/ext/ioncube.sh +21 -19
  31. package/src/scripts/ext/oci.ps1 +60 -60
  32. package/src/scripts/ext/oci.sh +65 -63
  33. package/src/scripts/ext/patches/firebird.sh +11 -11
  34. package/src/scripts/ext/patches/geos.sh +7 -7
  35. package/src/scripts/ext/patches/http.sh +11 -11
  36. package/src/scripts/ext/patches/pdo_oci.sh +6 -6
  37. package/src/scripts/ext/patches/phpize.sh +26 -26
  38. package/src/scripts/ext/patches/protobuf.sh +4 -4
  39. package/src/scripts/ext/phalcon.ps1 +54 -55
  40. package/src/scripts/ext/phalcon.sh +59 -59
  41. package/src/scripts/ext/source.sh +144 -144
  42. package/src/scripts/linux.sh +239 -280
  43. package/src/scripts/tools/add_tools.ps1 +28 -25
  44. package/src/scripts/tools/add_tools.sh +27 -19
  45. package/src/scripts/tools/blackfire.ps1 +19 -21
  46. package/src/scripts/tools/blackfire.sh +40 -35
  47. package/src/scripts/tools/grpc_php_plugin.ps1 +21 -21
  48. package/src/scripts/tools/grpc_php_plugin.sh +58 -61
  49. package/src/scripts/tools/ppa.sh +189 -0
  50. package/src/scripts/tools/protoc.ps1 +38 -38
  51. package/src/scripts/tools/protoc.sh +28 -28
  52. package/src/scripts/win32.ps1 +566 -471
  53. package/src/tools.ts +538 -509
  54. package/src/utils.ts +503 -497
  55. package/.eslintrc.json +0 -16
  56. package/.github/CODE_OF_CONDUCT.md +0 -76
  57. package/.github/CONTRIBUTING.md +0 -70
  58. package/.github/FUNDING.yml +0 -7
  59. package/.github/ISSUE_TEMPLATE/bug_report.md +0 -42
  60. package/.github/ISSUE_TEMPLATE/feature_request.md +0 -26
  61. package/.github/PULL_REQUEST_TEMPLATE.md +0 -37
  62. package/.github/SECURITY.md +0 -29
  63. package/.github/workflows/docs.yml +0 -77
  64. package/.github/workflows/node-workflow.yml +0 -51
  65. package/.github/workflows/workflow.yml +0 -78
  66. package/.idea/workspace.xml +0 -113
  67. package/.prettierrc.json +0 -12
  68. package/__tests__/config.test.ts +0 -52
  69. package/__tests__/coverage.test.ts +0 -110
  70. package/__tests__/extensions.test.ts +0 -261
  71. package/__tests__/install.test.ts +0 -175
  72. package/__tests__/tools.test.ts +0 -490
  73. package/__tests__/utils.test.ts +0 -303
  74. package/action.yml +0 -29
  75. package/dist/index.js +0 -3001
  76. package/examples/bedrock.yml +0 -32
  77. package/examples/blackfire-player.yml +0 -31
  78. package/examples/blackfire.yml +0 -31
  79. package/examples/cakephp-mysql.yml +0 -114
  80. package/examples/cakephp-postgres.yml +0 -112
  81. package/examples/cakephp.yml +0 -92
  82. package/examples/codeigniter.yml +0 -34
  83. package/examples/laravel-mysql.yml +0 -74
  84. package/examples/laravel-postgres.yml +0 -74
  85. package/examples/laravel.yml +0 -42
  86. package/examples/lumen-mysql.yml +0 -74
  87. package/examples/lumen-postgres.yml +0 -74
  88. package/examples/lumen.yml +0 -38
  89. package/examples/phalcon-mysql.yml +0 -74
  90. package/examples/phalcon-postgres.yml +0 -73
  91. package/examples/sage.yml +0 -57
  92. package/examples/slim-framework.yml +0 -34
  93. package/examples/symfony-mysql.yml +0 -57
  94. package/examples/symfony-postgres.yml +0 -55
  95. package/examples/symfony.yml +0 -39
  96. package/examples/yii2-mysql.yml +0 -73
  97. package/examples/yii2-postgres.yml +0 -71
  98. package/examples/zend-framework.yml +0 -36
  99. package/jest.config.js +0 -12
  100. package/lib/config.js +0 -72
  101. package/lib/config.js.map +0 -1
  102. package/lib/coverage.js +0 -88
  103. package/lib/coverage.js.map +0 -1
  104. package/lib/extensions.js +0 -201
  105. package/lib/extensions.js.map +0 -1
  106. package/lib/install.js +0 -82
  107. package/lib/install.js.map +0 -1
  108. package/lib/sapi.js +0 -64
  109. package/lib/tools.js +0 -387
  110. package/lib/tools.js.map +0 -1
  111. package/lib/utils.js +0 -292
  112. package/lib/utils.js.map +0 -1
  113. package/tsconfig.json +0 -18
@@ -1,490 +0,0 @@
1
- import * as tools from '../src/tools';
2
- import * as utils from '../src/utils';
3
-
4
- interface IData {
5
- tool: string;
6
- version: string;
7
- domain?: string;
8
- extension?: string;
9
- os_version?: string;
10
- php_version?: string;
11
- release?: string;
12
- repository?: string;
13
- type?: string;
14
- version_parameter?: string;
15
- version_prefix?: string;
16
- }
17
-
18
- function getData(data: IData): Record<string, string> {
19
- return {
20
- tool: data.tool,
21
- version: data.version,
22
- domain: data.domain || 'https://example.com',
23
- extension: data.extension || '.phar',
24
- os_version: data.os_version || 'linux',
25
- php_version: data.php_version || '7.4',
26
- release: data.release || [data.tool, data.version].join(':'),
27
- repository: data.repository || '',
28
- type: data.type || 'phar',
29
- version_parameter: data.version_parameter || '-V',
30
- version_prefix: data.version_prefix || '',
31
- github: 'https://github.com',
32
- prefix: 'releases',
33
- verb: 'download'
34
- };
35
- }
36
-
37
- jest
38
- .spyOn(utils, 'fetch')
39
- .mockImplementation(
40
- async (url: string, token?: string): Promise<Record<string, string>> => {
41
- if (!token || token === 'valid_token') {
42
- return {data: `[{"ref": "refs/tags/1.2.3", "url": "${url}"}]`};
43
- } else if (token === 'beta_token') {
44
- return {data: `[{"ref": "refs/tags/1.2.3-beta1", "url": "${url}"}]`};
45
- } else if (token === 'no_data') {
46
- return {data: '[]'};
47
- } else {
48
- return {error: 'Invalid token'};
49
- }
50
- }
51
- );
52
-
53
- describe('Tools tests', () => {
54
- it.each`
55
- token | version
56
- ${'invalid_token'} | ${'1.2'}
57
- ${'valid_token'} | ${'1.2.3'}
58
- ${'beta_token'} | ${'1.2.3-beta1'}
59
- ${''} | ${'1.2.3'}
60
- `('checking getSemverVersion: $token', async ({token, version}) => {
61
- process.env['COMPOSER_TOKEN'] = token;
62
- expect(
63
- await tools.getSemverVersion(getData({tool: 'tool', version: '1.2'}))
64
- ).toBe(version);
65
- });
66
-
67
- it.each`
68
- version | tool | type | expected
69
- ${'latest'} | ${'tool'} | ${'phar'} | ${'latest'}
70
- ${'1'} | ${'composer'} | ${'phar'} | ${'1'}
71
- ${'1.2'} | ${'tool'} | ${'composer'} | ${'1.2.*'}
72
- ${'^1.2.3'} | ${'tool'} | ${'phar'} | ${'1.2.3'}
73
- ${'>=1.2.3'} | ${'tool'} | ${'phar'} | ${'1.2.3'}
74
- ${'>1.2.3'} | ${'tool'} | ${'phar'} | ${'1.2.3'}
75
- ${'1.2.3-ALPHA'} | ${'tool'} | ${'phar'} | ${'1.2.3-ALPHA'}
76
- ${'1.2.3-alpha'} | ${'tool'} | ${'phar'} | ${'1.2.3-alpha'}
77
- ${'1.2.3-beta'} | ${'tool'} | ${'phar'} | ${'1.2.3-beta'}
78
- ${'1.2.3-rc'} | ${'tool'} | ${'phar'} | ${'1.2.3-rc'}
79
- ${'1.2.3-dev'} | ${'tool'} | ${'phar'} | ${'1.2.3-dev'}
80
- ${'1.2.3-alpha1'} | ${'tool'} | ${'phar'} | ${'1.2.3-alpha1'}
81
- ${'1.2.3-alpha.1'} | ${'tool'} | ${'phar'} | ${'1.2.3-alpha.1'}
82
- `(
83
- 'checking getVersion: $version, $tool, $type',
84
- async ({version, tool, type, expected}) => {
85
- expect(
86
- await tools.getVersion(
87
- version,
88
- getData({tool: tool, version: version, type: type})
89
- )
90
- ).toBe(expected);
91
- }
92
- );
93
-
94
- it.each`
95
- input | expected
96
- ${'tool'} | ${'tool'}
97
- ${'alias:1.2.3'} | ${'tool:1.2.3'}
98
- ${'tool:1.2.3'} | ${'tool:1.2.3'}
99
- ${'tool:^1.2.3'} | ${'tool:^1.2.3'}
100
- ${'tool:>=1.2.3'} | ${'tool:>=1.2.3'}
101
- ${'tool:>1.2.3'} | ${'tool:>1.2.3'}
102
- ${'tool:1.2.3-ALPHA'} | ${'tool:1.2.3-ALPHA'}
103
- ${'tool:1.2.3-beta'} | ${'tool:1.2.3-beta'}
104
- ${'tool:1.2.3-rc'} | ${'tool:1.2.3-rc'}
105
- ${'tool:1.2.3-dev'} | ${'tool:1.2.3-dev'}
106
- ${'tool:1.2.3-alpha1'} | ${'tool:1.2.3-alpha1'}
107
- ${'tool:1.2.3-alpha.1'} | ${'tool:1.2.3-alpha.1'}
108
- ${'user/tool:^1.2.3'} | ${'tool:^1.2.3'}
109
- `('checking getRelease: $input', async ({input, expected}) => {
110
- expect(
111
- await tools.getRelease(input, getData({tool: 'tool', version: 'latest'}))
112
- ).toBe(expected);
113
- });
114
-
115
- it.each`
116
- input_list | filtered_list
117
- ${'a, b'} | ${'composer, a, b'}
118
- ${'a, b, composer'} | ${'composer, a, b'}
119
- ${'a, b, composer:1.2.3'} | ${'composer:1.2.3, a, b'}
120
- ${'a, b, composer:v1.2.3'} | ${'composer:1.2.3, a, b'}
121
- ${'a, b, composer:snapshot'} | ${'composer:snapshot, a, b'}
122
- ${'a, b, composer:preview'} | ${'composer:preview, a, b'}
123
- ${'a, b, composer:1'} | ${'composer:1, a, b'}
124
- ${'a, b, composer:2'} | ${'composer:2, a, b'}
125
- ${'a, b, composer:v1'} | ${'composer:1, a, b'}
126
- ${'a, b, composer:v2'} | ${'composer:2, a, b'}
127
- `('checking filterList $input_list', async ({input_list, filtered_list}) => {
128
- expect(await tools.filterList(input_list.split(', '))).toStrictEqual(
129
- filtered_list.split(', ')
130
- );
131
- });
132
-
133
- it.each`
134
- version | version_prefix | url_suffix
135
- ${'latest'} | ${'v'} | ${'latest/download/tool.phar'}
136
- ${'1.2.3'} | ${'v'} | ${'download/v1.2.3/tool.phar'}
137
- ${'1.2.3'} | ${''} | ${'download/1.2.3/tool.phar'}
138
- `(
139
- 'checking getUrl: $version_prefix$version',
140
- async ({version, version_prefix, url_suffix}) => {
141
- const data = getData({
142
- tool: 'tool',
143
- version: version,
144
- version_prefix: version_prefix
145
- });
146
- expect(await tools.getUrl(data)).toContain(url_suffix);
147
- }
148
- );
149
-
150
- it.each`
151
- version | version_prefix | url
152
- ${'latest'} | ${''} | ${'https://example.com/tool.phar'}
153
- ${'1.2.3'} | ${'v'} | ${'https://example.com/tool-v1.2.3.phar'}
154
- `(
155
- 'checking getPharUrl: $version_prefix$version',
156
- async ({version, version_prefix, url}) => {
157
- const data = getData({
158
- tool: 'tool',
159
- version: version,
160
- version_prefix: version_prefix
161
- });
162
- expect(await tools.getPharUrl(data)).toBe(url);
163
- }
164
- );
165
-
166
- it.each`
167
- os_version | script
168
- ${'linux'} | ${'add_tool https://example.com/tool.phar tool "-v"'}
169
- ${'darwin'} | ${'add_tool https://example.com/tool.phar tool "-v"'}
170
- ${'win32'} | ${'Add-Tool https://example.com/tool.phar tool "-v"'}
171
- ${'openbsd'} | ${'Platform openbsd is not supported'}
172
- `('checking addArchive: $os_version', async ({os_version, script}) => {
173
- const data = getData({
174
- tool: 'tool',
175
- version: 'latest',
176
- version_parameter: JSON.stringify('-v'),
177
- os_version: os_version
178
- });
179
- data['url'] = 'https://example.com/tool.phar';
180
- expect(await tools.addArchive(data)).toContain(script);
181
- });
182
-
183
- it.each`
184
- os_version | script
185
- ${'linux'} | ${'add_composertool tool tool:1.2.3 user/'}
186
- ${'darwin'} | ${'add_composertool tool tool:1.2.3 user/'}
187
- ${'win32'} | ${'Add-Composertool tool tool:1.2.3 user/'}
188
- ${'openbsd'} | ${'Platform openbsd is not supported'}
189
- `('checking addPackage: $os_version', async ({os_version, script}) => {
190
- const data = getData({
191
- tool: 'tool',
192
- version: '1.2.3',
193
- repository: 'user/tool',
194
- os_version: os_version
195
- });
196
- data['release'] = [data['tool'], data['version']].join(':');
197
- expect(await tools.addPackage(data)).toContain(script);
198
- });
199
-
200
- it.each`
201
- version | php_version | os_version | script
202
- ${'latest'} | ${'7.4'} | ${'linux'} | ${'add_tool https://phar.io/releases/phive.phar phive'}
203
- ${'1.2.3'} | ${'7.4'} | ${'darwin'} | ${'add_tool https://github.com/phar-io/phive/releases/download/1.2.3/phive-1.2.3.phar phive'}
204
- ${'1.2.3'} | ${'7.2'} | ${'win32'} | ${'Add-Tool https://github.com/phar-io/phive/releases/download/0.14.5/phive-0.14.5.phar phive'}
205
- ${'1.2.3'} | ${'7.1'} | ${'win32'} | ${'Add-Tool https://github.com/phar-io/phive/releases/download/0.13.5/phive-0.13.5.phar phive'}
206
- ${'latest'} | ${'5.6'} | ${'win32'} | ${'Add-Tool https://github.com/phar-io/phive/releases/download/0.12.1/phive-0.12.1.phar phive'}
207
- ${'latest'} | ${'5.5'} | ${'win32'} | ${'Phive is not supported on PHP 5.5'}
208
- `(
209
- 'checking addPhive: $version, $php_version, $os_version',
210
- async ({version, php_version, os_version, script}) => {
211
- const data = getData({
212
- tool: 'phive',
213
- domain: 'https://phar.io',
214
- repository: 'phar-io/phive',
215
- version_parameter: 'status',
216
- version: version,
217
- php_version: php_version,
218
- os_version: os_version
219
- });
220
- script = await tools.addPhive(data);
221
- expect(script).toContain(script);
222
- }
223
- );
224
-
225
- it.each`
226
- version | php_version | url
227
- ${'latest'} | ${'7.4'} | ${'https://get.blackfire.io/blackfire-player.phar'}
228
- ${'1.2.3'} | ${'7.4'} | ${'https://get.blackfire.io/blackfire-player-v1.2.3.phar'}
229
- ${'latest'} | ${'5.5'} | ${'https://get.blackfire.io/blackfire-player-v1.9.3.phar'}
230
- ${'latest'} | ${'7.0'} | ${'https://get.blackfire.io/blackfire-player-v1.9.3.phar'}
231
- `(
232
- 'checking addBlackfirePlayer: $version, $php_version',
233
- async ({version, php_version, url}) => {
234
- const data = getData({
235
- tool: 'blackfire-player',
236
- domain: 'https://get.blackfire.io',
237
- version_prefix: 'v',
238
- version: version,
239
- php_version: php_version
240
- });
241
- expect(await tools.addBlackfirePlayer(data)).toContain(url);
242
- }
243
- );
244
-
245
- it.each`
246
- version | url
247
- ${'latest'} | ${'https://deployer.org/deployer.phar'}
248
- ${'1.2.3'} | ${'https://deployer.org/releases/v1.2.3/deployer.phar'}
249
- `('checking addDeployer: $version', async ({version, url}) => {
250
- const data = getData({
251
- tool: 'deployer',
252
- domain: 'https://deployer.org',
253
- version: version
254
- });
255
- expect(await tools.addDeployer(data)).toContain(url);
256
- });
257
-
258
- it.each`
259
- version | cache_url | source_url
260
- ${'latest'} | ${'https://github.com/shivammathur/composer-cache/releases/latest/download/composer-stable.phar'} | ${'https://getcomposer.org/composer-stable.phar'}
261
- ${'stable'} | ${'https://github.com/shivammathur/composer-cache/releases/latest/download/composer-stable.phar'} | ${'https://getcomposer.org/composer-stable.phar'}
262
- ${'snapshot'} | ${'https://github.com/shivammathur/composer-cache/releases/latest/download/composer-snapshot.phar'} | ${'https://getcomposer.org/composer.phar'}
263
- ${'preview'} | ${'https://github.com/shivammathur/composer-cache/releases/latest/download/composer-preview.phar'} | ${'https://getcomposer.org/composer-preview.phar'}
264
- ${'1'} | ${'https://github.com/shivammathur/composer-cache/releases/latest/download/composer-1.phar'} | ${'https://getcomposer.org/composer-1.phar'}
265
- ${'2'} | ${'https://github.com/shivammathur/composer-cache/releases/latest/download/composer-2.phar'} | ${'https://getcomposer.org/composer-2.phar'}
266
- ${'1.2.3'} | ${'https://github.com/composer/composer/releases/download/1.2.3/composer.phar'} | ${'https://getcomposer.org/composer-1.2.3.phar'}
267
- ${'1.2.3-RC1'} | ${'https://github.com/composer/composer/releases/download/1.2.3-RC1/composer.phar'} | ${'https://getcomposer.org/composer-1.2.3-RC1.phar'}
268
- `(
269
- 'checking addComposer: $version',
270
- async ({version, cache_url, source_url}) => {
271
- const data = getData({
272
- tool: 'composer',
273
- domain: 'https://getcomposer.org',
274
- repository: 'composer/composer',
275
- version: version
276
- });
277
- expect(await tools.addComposer(data)).toContain(cache_url);
278
- expect(await tools.addComposer(data)).toContain(source_url);
279
- }
280
- );
281
-
282
- it.each`
283
- version | os_version | uri
284
- ${'latest'} | ${'linux'} | ${'releases/latest/download/symfony_linux_amd64'}
285
- ${'1.2.3'} | ${'linux'} | ${'releases/download/v1.2.3/symfony_linux_amd64'}
286
- ${'latest'} | ${'darwin'} | ${'releases/latest/download/symfony_darwin_amd64'}
287
- ${'1.2.3'} | ${'darwin'} | ${'releases/download/v1.2.3/symfony_darwin_amd64'}
288
- ${'latest'} | ${'win32'} | ${'releases/latest/download/symfony_windows_amd64.exe'}
289
- ${'1.2.3'} | ${'win32'} | ${'releases/download/v1.2.3/symfony_windows_amd64.exe'}
290
- ${'latest'} | ${'openbsd'} | ${'Platform openbsd is not supported'}
291
- `(
292
- 'checking addSymfony: $version, $os_version',
293
- async ({version, os_version, uri}) => {
294
- const data = getData({
295
- tool: 'symfony',
296
- php_version: '7.4',
297
- version: version,
298
- os_version: os_version
299
- });
300
- expect(await tools.addSymfony(data)).toContain(uri);
301
- }
302
- );
303
-
304
- it.each`
305
- version | uri
306
- ${'latest'} | ${'wp-cli/builds/blob/gh-pages/phar/wp-cli.phar?raw=true'}
307
- ${'1.2.3'} | ${'wp-cli/wp-cli/releases/download/v1.2.3/wp-cli-1.2.3.phar'}
308
- `('checking addWPCLI: $version', async ({version, uri}) => {
309
- const data = getData({
310
- tool: 'wp-cli',
311
- repository: 'wp-cli/wp-cli',
312
- php_version: '7.4',
313
- version_prefix: 'v',
314
- version: version
315
- });
316
- expect(await tools.addWPCLI(data)).toContain(uri);
317
- });
318
-
319
- it.each`
320
- tool | os_version | script
321
- ${'phpize'} | ${'linux'} | ${'add_devtools phpize'}
322
- ${'php-config'} | ${'linux'} | ${'add_devtools php-config'}
323
- ${'phpize'} | ${'darwin'} | ${'add_devtools phpize'}
324
- ${'php-config'} | ${'darwin'} | ${'add_devtools php-config'}
325
- ${'phpize'} | ${'win32'} | ${'Add-Log "$tick" "phpize" "phpize is not a windows tool"'}
326
- ${'php-config'} | ${'win32'} | ${'Add-Log "$tick" "php-config" "php-config is not a windows tool"'}
327
- ${'phpize'} | ${'openbsd'} | ${'Platform openbsd is not supported'}
328
- `(
329
- 'checking addDevTools: $tool, $os_version',
330
- async ({tool, os_version, script}) => {
331
- const data = getData({
332
- version: '7.4',
333
- tool: tool,
334
- os_version: os_version
335
- });
336
- expect(await tools.addDevTools(data)).toContain(script);
337
- }
338
- );
339
-
340
- it.each([
341
- [
342
- 'blackfire, blackfire-player, cs2pr, flex, grpc_php_plugin, php-cs-fixer, phplint, phpstan, phpunit, pecl, phing, phinx, phinx:1.2.3, phive, phpunit-bridge, php-config, phpize, protoc, symfony, vapor, wp',
343
- [
344
- 'add_tool https://github.com/shivammathur/composer-cache/releases/latest/download/composer-stable.phar,https://getcomposer.org/composer-stable.phar composer',
345
- 'add_blackfire',
346
- 'add_tool https://get.blackfire.io/blackfire-player.phar blackfire-player "-V"',
347
- 'add_tool https://github.com/staabm/annotate-pull-request-from-checkstyle/releases/latest/download/cs2pr cs2pr "-V"',
348
- 'add_composertool flex flex symfony/',
349
- 'add_grpc_php_plugin latest',
350
- 'add_tool https://github.com/FriendsOfPHP/PHP-CS-Fixer/releases/latest/download/php-cs-fixer.phar php-cs-fixer "-V"',
351
- 'add_composertool phplint phplint overtrue/',
352
- 'add_tool https://github.com/phpstan/phpstan/releases/latest/download/phpstan.phar phpstan "-V"',
353
- 'add_tool https://phar.phpunit.de/phpunit.phar phpunit "--version"',
354
- 'add_pecl',
355
- 'add_tool https://www.phing.info/get/phing-latest.phar phing "-v"',
356
- 'add_composertool phinx phinx robmorgan/',
357
- 'add_composertool phinx phinx:1.2.3 robmorgan/',
358
- 'add_tool https://phar.io/releases/phive.phar phive "status"',
359
- 'add_composertool phpunit-bridge phpunit-bridge symfony/',
360
- 'add_devtools php-config',
361
- 'add_devtools phpize',
362
- 'add_protoc latest',
363
- 'add_tool https://github.com/symfony/cli/releases/latest/download/symfony_linux_amd64 symfony-cli "version"',
364
- 'add_composertool vapor-cli vapor-cli laravel/',
365
- 'add_tool https://github.com/wp-cli/builds/blob/gh-pages/phar/wp-cli.phar?raw=true wp-cli "--version"'
366
- ]
367
- ]
368
- ])('checking addTools on linux', async (tools_csv, scripts) => {
369
- const expected = await tools.addTools(tools_csv, '7.4', 'linux');
370
- scripts.forEach(script => {
371
- expect(expected).toContain(script);
372
- });
373
- });
374
-
375
- it.each([
376
- [
377
- 'behat, blackfire, blackfire-player, composer-normalize, composer-require-checker, composer-unused, cs2pr:1.2.3, flex, grpc_php_plugin:1.2.3, infection, phan, phan:1.2.3, phing:1.2.3, phinx, phive:1.2.3, php-config, phpcbf, phpcpd, phpcs, phpize, phpmd, phpspec, phpunit-bridge:5.6, protoc:v1.2.3, psalm, symfony-cli, symfony:1.2.3, vapor-cli, wp-cli',
378
- [
379
- 'add_tool https://github.com/shivammathur/composer-cache/releases/latest/download/composer-stable.phar,https://getcomposer.org/composer-stable.phar composer',
380
- 'add_composertool behat behat behat/',
381
- 'add_blackfire',
382
- 'add_tool https://get.blackfire.io/blackfire-player.phar blackfire-player "-V"',
383
- 'add_tool https://github.com/ergebnis/composer-normalize/releases/latest/download/composer-normalize.phar composer-normalize "-V"',
384
- 'add_composertool composer-require-checker composer-require-checker maglnet/',
385
- 'add_composertool composer-unused composer-unused icanhazstring/',
386
- 'add_tool https://github.com/staabm/annotate-pull-request-from-checkstyle/releases/download/1.2.3/cs2pr cs2pr "-V"',
387
- 'add_composertool flex flex symfony/',
388
- 'add_grpc_php_plugin 1.2.3',
389
- 'add_tool https://github.com/infection/infection/releases/latest/download/infection.phar infection "-V"',
390
- 'add_tool https://github.com/phan/phan/releases/latest/download/phan.phar phan "-v"',
391
- 'add_tool https://github.com/phan/phan/releases/download/1.2.3/phan.phar phan "-v"',
392
- 'add_tool https://www.phing.info/get/phing-1.2.3.phar phing "-v"',
393
- 'add_composertool phinx phinx robmorgan/',
394
- 'add_tool https://github.com/phar-io/phive/releases/download/1.2.3/phive-1.2.3.phar phive',
395
- 'add_devtools php-config',
396
- 'add_tool https://github.com/squizlabs/PHP_CodeSniffer/releases/latest/download/phpcbf.phar phpcbf "--version"',
397
- 'add_tool https://phar.phpunit.de/phpcpd.phar phpcpd "--version"',
398
- 'add_tool https://github.com/squizlabs/PHP_CodeSniffer/releases/latest/download/phpcs.phar phpcs "--version"',
399
- 'add_devtools phpize',
400
- 'add_tool https://github.com/phpmd/phpmd/releases/latest/download/phpmd.phar phpmd "--version"',
401
- 'add_composertool phpspec phpspec phpspec/',
402
- 'add_composertool phpunit-bridge phpunit-bridge:5.6.* symfony/',
403
- 'add_protoc 1.2.3',
404
- 'add_tool https://github.com/vimeo/psalm/releases/latest/download/psalm.phar psalm "-v"',
405
- 'add_tool https://github.com/symfony/cli/releases/latest/download/symfony_darwin_amd64 symfony-cli "version"',
406
- 'add_tool https://github.com/symfony/cli/releases/download/v1.2.3/symfony_darwin_amd64 symfony-cli "version"',
407
- 'add_composertool vapor-cli vapor-cli laravel/',
408
- 'add_tool https://github.com/wp-cli/builds/blob/gh-pages/phar/wp-cli.phar?raw=true wp-cli "--version"'
409
- ]
410
- ]
411
- ])('checking addTools on darwin', async (tools_csv, scripts) => {
412
- const expected = await tools.addTools(tools_csv, '7.4', 'darwin');
413
- scripts.forEach(script => {
414
- expect(expected).toContain(script);
415
- });
416
- });
417
-
418
- it.each([
419
- [
420
- 'blackfire, blackfire-player:1.2.3, cs2pr, deployer, does_not_exist, flex, phinx, phive:0.13.2, php-config, phpize, phpmd, simple-phpunit, symfony, wp',
421
- [
422
- 'Add-Tool https://github.com/shivammathur/composer-cache/releases/latest/download/composer-stable.phar,https://getcomposer.org/composer-stable.phar composer',
423
- 'Add-Blackfire',
424
- 'Add-Tool https://get.blackfire.io/blackfire-player-v1.2.3.phar blackfire-player "-V"',
425
- 'Add-Tool https://github.com/staabm/annotate-pull-request-from-checkstyle/releases/latest/download/cs2pr cs2pr "-V"',
426
- 'Add-Tool https://deployer.org/deployer.phar deployer "-V"',
427
- 'Tool does_not_exist is not supported',
428
- 'Add-Composertool flex flex symfony/',
429
- 'Add-Composertool phinx phinx robmorgan/',
430
- 'Add-Tool https://github.com/phar-io/phive/releases/download/0.13.2/phive-0.13.2.phar phive "status"',
431
- 'php-config is not a windows tool',
432
- 'phpize is not a windows tool',
433
- 'Add-Tool https://github.com/phpmd/phpmd/releases/latest/download/phpmd.phar phpmd "--version"',
434
- 'Add-Composertool phpunit-bridge phpunit-bridge symfony/',
435
- 'Add-Tool https://github.com/symfony/cli/releases/latest/download/symfony_windows_amd64.exe symfony-cli "version"',
436
- 'Add-Tool https://github.com/wp-cli/builds/blob/gh-pages/phar/wp-cli.phar?raw=true wp-cli "--version"'
437
- ]
438
- ]
439
- ])('checking addTools on Windows', async (tools_csv, scripts) => {
440
- const expected = await tools.addTools(tools_csv, '7.4', 'win32');
441
- scripts.forEach(script => {
442
- expect(expected).toContain(script);
443
- });
444
- });
445
-
446
- it.each([
447
- [
448
- 'composer:v1, codeception/codeception, prestissimo, hirak/prestissimo, composer-prefetcher, narrowspark/automatic-composer-prefetcher, phinx: 1.2, robmorgan/phinx: ^1.2, user/tool:1.2.3, user/tool:~1.2',
449
- [
450
- 'Add-Tool https://github.com/shivammathur/composer-cache/releases/latest/download/composer-1.phar,https://getcomposer.org/composer-1.phar composer',
451
- 'Add-Composertool codeception codeception codeception/',
452
- 'Add-Composertool prestissimo prestissimo hirak/',
453
- 'Add-Composertool automatic-composer-prefetcher automatic-composer-prefetcher narrowspark/',
454
- 'Add-Composertool phinx phinx:1.2.* robmorgan/',
455
- 'Add-Composertool phinx phinx:^1.2 robmorgan/',
456
- 'Add-Composertool tool tool:1.2.3 user/',
457
- 'Add-Composertool tool tool:~1.2 user/'
458
- ]
459
- ]
460
- ])(
461
- 'checking addTools with composer tool using user/tool as input',
462
- async (tools_csv, scripts) => {
463
- const expected = await tools.addTools(tools_csv, '7.4', 'win32');
464
- scripts.forEach(script => {
465
- expect(expected).toContain(script);
466
- });
467
- }
468
- );
469
-
470
- it.each`
471
- tools_csv | script
472
- ${'none'} | ${''}
473
- ${'none, phpunit'} | ${'\nstep_log "Setup Tools"\nadd_tool https://github.com/shivammathur/composer-cache/releases/latest/download/composer-stable.phar,https://getcomposer.org/composer-stable.phar composer latest\n\nadd_tool https://phar.phpunit.de/phpunit.phar phpunit "--version"'}
474
- ${'composer:preview'} | ${'add_tool https://github.com/shivammathur/composer-cache/releases/latest/download/composer-preview.phar,https://getcomposer.org/composer-preview.phar composer preview'}
475
- ${'composer, composer:v1'} | ${'add_tool https://github.com/shivammathur/composer-cache/releases/latest/download/composer-1.phar,https://getcomposer.org/composer-1.phar composer'}
476
- ${'composer:v1, composer:preview, composer:snapshot'} | ${'add_tool https://github.com/shivammathur/composer-cache/releases/latest/download/composer-snapshot.phar,https://getcomposer.org/composer.phar composer snapshot'}
477
- `('checking composer setup: $tools_csv', async ({tools_csv, script}) => {
478
- expect(await tools.addTools(tools_csv, '7.4', 'linux')).toContain(script);
479
- });
480
-
481
- it.each`
482
- tools_csv | token | script
483
- ${'cs2pr:1.2'} | ${'invalid_token'} | ${'add_log "$cross" "cs2pr" "Invalid token"'}
484
- ${'phpunit:1.2'} | ${'invalid_token'} | ${'add_log "$cross" "phpunit" "Invalid token"'}
485
- ${'phpunit:0.1'} | ${'no_data'} | ${'add_log "$cross" "phpunit" "No version found with prefix 0.1."'}
486
- `('checking error: $tools_csv', async ({tools_csv, token, script}) => {
487
- process.env['COMPOSER_TOKEN'] = token;
488
- expect(await tools.addTools(tools_csv, '7.4', 'linux')).toContain(script);
489
- });
490
- });