Add fallback url for phpunit tools

This commit is contained in:
Shivam Mathur 2025-02-07 05:40:29 +05:30
parent 89a5bffb0b
commit 3bfebc13bc
No known key found for this signature in database
GPG Key ID: 3E13E4C8591ACC2A
3 changed files with 6 additions and 3 deletions

View File

@ -408,7 +408,7 @@ describe('Tools tests', () => {
'add_tool https://github.com/phpDocumentor/phpDocumentor/releases/latest/download/phpDocumentor.phar phpDocumentor "--version"',
'add_composer_tool phplint phplint overtrue/',
'add_tool https://github.com/phpstan/phpstan/releases/latest/download/phpstan.phar phpstan "-V"',
'add_tool https://phar.phpunit.de/phpunit-7.4.0.phar phpunit "--version"',
'add_tool https://phar.phpunit.de/phpunit-7.4.0.phar,https://phar.phpunit.de/phpunit-7.phar phpunit "--version"',
'add_pecl',
'add_tool https://www.phing.info/get/phing-latest.phar phing "-v"',
'add_composer_tool phinx phinx robmorgan/ scoped',
@ -562,7 +562,7 @@ describe('Tools tests', () => {
it.each`
tools_csv | script
${'none'} | ${''}
${'none, phpunit'} | ${'\nstep_log "Setup Tools"\nadd_tool https://github.com/shivammathur/composer-cache/releases/latest/download/composer-7.4-stable.phar,https://dl.cloudsmith.io/public/shivammathur/composer-cache/raw/files/composer-7.4-stable.phar,https://getcomposer.org/composer-stable.phar composer latest\n\nadd_tool https://phar.phpunit.de/phpunit-7.4.0.phar phpunit "--version"'}
${'none, phpunit'} | ${'\nstep_log "Setup Tools"\nadd_tool https://github.com/shivammathur/composer-cache/releases/latest/download/composer-7.4-stable.phar,https://dl.cloudsmith.io/public/shivammathur/composer-cache/raw/files/composer-7.4-stable.phar,https://getcomposer.org/composer-stable.phar composer latest\n\nadd_tool https://phar.phpunit.de/phpunit-7.4.0.phar,https://phar.phpunit.de/phpunit-7.phar phpunit "--version"'}
${'composer:preview'} | ${'add_tool https://github.com/shivammathur/composer-cache/releases/latest/download/composer-7.4-preview.phar,https://dl.cloudsmith.io/public/shivammathur/composer-cache/raw/files/composer-7.4-preview.phar,https://getcomposer.org/composer-preview.phar composer preview'}
${'composer, composer:v1'} | ${'add_tool https://github.com/shivammathur/composer-cache/releases/latest/download/composer-7.4-1.phar,https://dl.cloudsmith.io/public/shivammathur/composer-cache/raw/files/composer-7.4-1.phar,https://getcomposer.org/composer-1.phar composer'}
${'composer:v1, composer:preview, composer:snapshot'} | ${'add_tool https://github.com/shivammathur/composer-cache/releases/latest/download/composer-7.4-snapshot.phar,https://dl.cloudsmith.io/public/shivammathur/composer-cache/raw/files/composer-7.4-snapshot.phar,https://getcomposer.org/composer.phar composer snapshot'}

2
dist/index.js vendored

File diff suppressed because one or more lines are too long

View File

@ -422,6 +422,9 @@ export async function addPHPUnitTools(data: RS): Promise<string> {
'latest';
}
data['url'] = await getPharUrl(data);
if (data['url'].match(/-\d+/)) {
data['url'] += ',' + data['url'].replace(/-(\d+)\.\d+\.\d+/, '-$1');
}
return await addArchive(data);
}