Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Phpunit versions #732

Merged
merged 2 commits into from Jun 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
18 changes: 18 additions & 0 deletions __tests__/tools.test.ts
Expand Up @@ -540,4 +540,22 @@ describe('Tools tests', () => {
process.env['GITHUB_TOKEN'] = token;
expect(await tools.addTools(tools_csv, '7.4', 'linux')).toContain(script);
});

it.each`
tools_csv | php_version | resolved
${'phpunit'} | ${'8.2'} | ${'/phpunit.phar'}
${'phpunit'} | ${'8.1'} | ${'/phpunit.phar'}
${'phpunit'} | ${'8.0'} | ${'/phpunit-9.6.8.phar'}
${'phpunit'} | ${'7.3'} | ${'/phpunit-9.6.8.phar'}
${'phpunit'} | ${'7.2'} | ${'/phpunit-8.5.33.phar'}
${'phpunit'} | ${'7.1'} | ${'/phpunit-7.5.20.phar'}
${'phpunit'} | ${'7.0'} | ${'/phpunit-6.5.14.phar'}
`(
'checking error: $tools_csv',
async ({tools_csv, php_version, resolved}) => {
expect(await tools.addTools(tools_csv, php_version, 'linux')).toContain(
resolved
);
}
);
});
11 changes: 11 additions & 0 deletions dist/index.js
Expand Up @@ -885,6 +885,17 @@ async function addPhive(data) {
}
exports.addPhive = addPhive;
async function addPHPUnitTools(data) {
if (data['version'] == 'latest') {
if (/7\.3|8\.0/.test(data['php_version'])) {
data['version'] = '9.6.8';
} else if (/7\.[2-3]/.test(data['php_version'])) {
data['version'] = '8.5.33';
} else if (/7\.[1-3]/.test(data['php_version'])) {
data['version'] = '7.5.20';
} else if (/7\.[0-2]/.test(data['php_version'])) {
data['version'] = '6.5.14';
}
}
data['url'] = await getPharUrl(data);
return await addArchive(data);
}
Expand Down
11 changes: 11 additions & 0 deletions src/tools.ts
Expand Up @@ -392,6 +392,17 @@ export async function addPhive(data: RS): Promise<string> {
* @param data
*/
export async function addPHPUnitTools(data: RS): Promise<string> {
if (data['version'] == 'latest') {
if (/7\.3|8\.0/.test(data['php_version'])) {
data['version'] = '9.6.8';
} else if (/7\.[2-3]/.test(data['php_version'])) {
data['version'] = '8.5.33';
} else if (/7\.[1-3]/.test(data['php_version'])) {
data['version'] = '7.5.20';
} else if (/7\.[0-2]/.test(data['php_version'])) {
data['version'] = '6.5.14';
}
}
data['url'] = await getPharUrl(data);
return await addArchive(data);
}
Expand Down