Skip to content

Commit

Permalink
v1 maintenance release - 1.8.4
Browse files Browse the repository at this point in the history
  • Loading branch information
shivammathur committed Mar 2, 2020
1 parent 3579c7e commit 0da52b1
Show file tree
Hide file tree
Showing 15 changed files with 516 additions and 522 deletions.
151 changes: 93 additions & 58 deletions __tests__/tools.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,28 +2,34 @@ import * as tools from '../src/tools';

describe('Tools tests', () => {
it('checking getCommand', async () => {
expect(await tools.getArchiveCommand('linux')).toBe('add_tool ');
expect(await tools.getArchiveCommand('darwin')).toBe('add_tool ');
expect(await tools.getArchiveCommand('win32')).toBe('Add-Tool ');
expect(await tools.getArchiveCommand('fedora')).toContain(
expect(await tools.getCommand('linux', 'tool')).toBe('add_tool ');
expect(await tools.getCommand('darwin', 'tool')).toBe('add_tool ');
expect(await tools.getCommand('win32', 'tool')).toBe('Add-Tool ');
expect(await tools.getCommand('fedora', 'tool')).toContain(
'Platform fedora is not supported'
);
});

it('checking getCommand', async () => {
expect(await tools.getPackageCommand('linux')).toBe('add_composer_tool ');
expect(await tools.getPackageCommand('darwin')).toBe('add_composer_tool ');
expect(await tools.getPackageCommand('win32')).toBe('Add-Composer-Tool ');
expect(await tools.getPackageCommand('fedora')).toContain(
expect(await tools.getCommand('linux', 'composertool')).toBe(
'add_composertool '
);
expect(await tools.getCommand('darwin', 'composertool')).toBe(
'add_composertool '
);
expect(await tools.getCommand('win32', 'composertool')).toBe(
'Add-Composertool '
);
expect(await tools.getCommand('fedora', 'composertool')).toContain(
'Platform fedora is not supported'
);
});

it('checking getPECLCommand', async () => {
expect(await tools.getPECLCommand('linux')).toBe('add_pecl ');
expect(await tools.getPECLCommand('darwin')).toBe('add_pecl ');
expect(await tools.getPECLCommand('win32')).toBe('Add-PECL ');
expect(await tools.getPECLCommand('fedora')).toContain(
it('checking getCommand', async () => {
expect(await tools.getCommand('linux', 'pecl')).toBe('add_pecl ');
expect(await tools.getCommand('darwin', 'pecl')).toBe('add_pecl ');
expect(await tools.getCommand('win32', 'pecl')).toBe('Add-Pecl ');
expect(await tools.getCommand('fedora', 'pecl')).toContain(
'Platform fedora is not supported'
);
});
Expand Down Expand Up @@ -107,22 +113,13 @@ describe('Tools tests', () => {
});

it('checking getCodeceptionUriBuilder', async () => {
expect(await tools.getCodeceptionUriBuilder('3.2.1', '5.6', 'php56')).toBe(
expect(await tools.getCodeceptionUriBuilder('3.2.1', 'php56')).toBe(
'releases/3.2.1/php56/codecept.phar'
);
expect(await tools.getCodeceptionUriBuilder('3.2.1', '7.0', 'php54')).toBe(
expect(await tools.getCodeceptionUriBuilder('3.2.1', 'php54')).toBe(
'releases/3.2.1/php54/codecept.phar'
);
expect(await tools.getCodeceptionUriBuilder('3.2.1', '7.1', 'php56')).toBe(
'releases/3.2.1/php56/codecept.phar'
);
expect(await tools.getCodeceptionUriBuilder('3.2.1', '7.2', 'php56')).toBe(
'releases/3.2.1/codecept.phar'
);
expect(await tools.getCodeceptionUriBuilder('3.2.1', '7.3', 'php56')).toBe(
'releases/3.2.1/codecept.phar'
);
expect(await tools.getCodeceptionUriBuilder('3.2.1', '7.4', 'php56')).toBe(
expect(await tools.getCodeceptionUriBuilder('3.2.1', '')).toBe(
'releases/3.2.1/codecept.phar'
);
});
Expand All @@ -146,17 +143,59 @@ describe('Tools tests', () => {
expect(await tools.getCodeceptionUri('latest', '7.4')).toBe(
'codecept.phar'
);
expect(await tools.getCodeceptionUri('3.2.1', '5.6')).toBe(
'releases/3.2.1/php54/codecept.phar'
expect(await tools.getCodeceptionUri('4.0.0', '7.4')).toBe(
'releases/4.0.0/codecept.phar'
);
expect(await tools.getCodeceptionUri('4.3.2', '5.6')).toBe(
'releases/4.3.2/php56/codecept.phar'
expect(await tools.getCodeceptionUri('4.0.0', '5.6')).toBe(
'releases/4.0.0/php56/codecept.phar'
);
expect(await tools.getCodeceptionUri('3.2.1', '7.4')).toBe(
'releases/3.2.1/codecept.phar'
expect(await tools.getCodeceptionUri('4.0.0', '7.1')).toBe(
'releases/4.0.0/php56/codecept.phar'
);
expect(await tools.getCodeceptionUri('3.1.0', '7.4')).toBe(
'releases/3.1.0/codecept.phar'
);
expect(await tools.getCodeceptionUri('3.1.0', '5.6')).toBe(
'releases/3.1.0/php54/codecept.phar'
);
expect(await tools.getCodeceptionUri('2.5.4', '7.4')).toBe(
'releases/2.5.4/codecept.phar'
);
expect(await tools.getCodeceptionUri('2.5.4', '5.6')).toBe(
'releases/2.5.4/php54/codecept.phar'
);
expect(await tools.getCodeceptionUri('4.3.2', '7.4')).toBe(
'releases/4.3.2/codecept.phar'
expect(await tools.getCodeceptionUri('2.3.4', '7.4')).toBe(
'releases/2.3.4/codecept.phar'
);
expect(await tools.getCodeceptionUri('2.3.4', '5.4')).toBe(
'releases/2.3.4/php54/codecept.phar'
);
expect(await tools.getCodeceptionUri('2.2.4', '5.6')).toBe(
'releases/2.2.4/codecept.phar'
);
expect(await tools.getCodeceptionUri('2.2.4', '7.4')).toBe(
'releases/2.2.4/codecept.phar'
);
expect(await tools.getCodeceptionUri('2.2.4', '5.4')).toBe(
'releases/2.2.4/php54/codecept.phar'
);
expect(await tools.getCodeceptionUri('2.1.7', '5.6')).toBe(
'releases/2.1.7/codecept.phar'
);
expect(await tools.getCodeceptionUri('2.1.7', '5.4')).toBe(
'releases/2.1.7/php54/codecept.phar'
);
expect(await tools.getCodeceptionUri('2.1.5', '5.4')).toBe(
'releases/2.1.5/codecept.phar'
);
expect(await tools.getCodeceptionUri('2.1.5', '7.4')).toBe(
'releases/2.1.5/codecept.phar'
);
expect(await tools.getCodeceptionUri('1.6.9', '7.4')).toBe(
'releases/1.6.9/codecept.phar'
);
expect(await tools.getCodeceptionUri('1.5.0', '7.4')).toBe(
'releases/1.5.0/codecept.phar'
);
});

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

it('checking getPhpunitUri', async () => {
expect(await tools.getPhpunitUrl('tool', 'latest')).toBe(
'https://phar.phpunit.de/tool.phar'
expect(await tools.getPharUrl('domain', 'tool', '', 'latest')).toBe(
'domain/tool.phar'
);
expect(await tools.getPhpunitUrl('tool', '1.2.3')).toBe(
'https://phar.phpunit.de/tool-1.2.3.phar'
expect(await tools.getPharUrl('domain', 'tool', 'v', '1.2.3')).toBe(
'domain/tool-v1.2.3.phar'
);
});

Expand All @@ -190,7 +229,7 @@ describe('Tools tests', () => {
);
});

it('checking getDeployerUri', async () => {
it('checking addComposer', async () => {
expect(await tools.addComposer(['a', 'b'])).toStrictEqual([
'composer',
'a',
Expand Down Expand Up @@ -311,13 +350,13 @@ describe('Tools tests', () => {
'user/',
'linux'
);
expect(script).toContain('add_composer_tool tool tool:1.2.3 user/');
expect(script).toContain('add_composertool tool tool:1.2.3 user/');

script = await tools.addPackage('tool', 'tool:1.2.3', 'user/', 'darwin');
expect(script).toContain('add_composer_tool tool tool:1.2.3 user/');
expect(script).toContain('add_composertool tool tool:1.2.3 user/');

script = await tools.addPackage('tool', 'tool:1.2.3', 'user/', 'win32');
expect(script).toContain('Add-Composer-Tool tool tool:1.2.3 user/');
expect(script).toContain('Add-Composertool tool tool:1.2.3 user/');

script = await tools.addPackage('tool', 'tool:1.2.3', 'user/', 'fedora');
expect(script).toContain('Platform fedora is not supported');
Expand All @@ -330,7 +369,7 @@ describe('Tools tests', () => {
'linux'
);
expect(script).toContain(
'add_tool https://github.com/composer/composer/releases/latest/download/composer.phar composer'
'add_tool https://getcomposer.org/composer-stable.phar composer'
);
expect(script).toContain(
'add_tool https://github.com/staabm/annotate-pull-request-from-checkstyle/releases/latest/download/cs2pr cs2pr'
Expand All @@ -351,8 +390,8 @@ describe('Tools tests', () => {
'add_tool https://github.com/symfony/cli/releases/latest/download/symfony_linux_amd64 symfony'
);
expect(script).toContain('add_pecl');
expect(script).toContain('add_composer_tool phinx phinx robmorgan/');
expect(script).toContain('add_composer_tool phinx phinx:1.2.3 robmorgan/');
expect(script).toContain('add_composertool phinx phinx robmorgan/');
expect(script).toContain('add_composertool phinx phinx:1.2.3 robmorgan/');
expect(script).toContain('add_devtools');
expect(script).toContain('add_log "$tick" "php-config" "Added"');
expect(script).toContain('add_log "$tick" "phpize" "Added"');
Expand All @@ -364,7 +403,7 @@ describe('Tools tests', () => {
'darwin'
);
expect(script).toContain(
'add_tool https://github.com/composer/composer/releases/latest/download/composer.phar composer'
'add_tool https://getcomposer.org/composer-stable.phar composer'
);
expect(script).toContain(
'add_tool https://github.com/staabm/annotate-pull-request-from-checkstyle/releases/download/1.2.3/cs2pr cs2pr'
Expand All @@ -384,12 +423,12 @@ describe('Tools tests', () => {
expect(script).toContain(
'https://github.com/vimeo/psalm/releases/latest/download/psalm.phar psalm'
);
expect(script).toContain('add_composer_tool phinx phinx robmorgan/');
expect(script).toContain('add_composertool phinx phinx robmorgan/');
expect(script).toContain(
'add_tool https://github.com/phar-io/phive/releases/download/1.2.3/phive-1.2.3.phar phive'
);
expect(script).toContain(
'add_composer_tool composer-prefetcher composer-prefetcher:1.2.3 narrowspark/automatic-'
'add_composertool composer-prefetcher composer-prefetcher:1.2.3 narrowspark/automatic-'
);
expect(script).toContain(
'add_tool https://github.com/symfony/cli/releases/latest/download/symfony_darwin_amd64 symfony'
Expand All @@ -407,21 +446,19 @@ describe('Tools tests', () => {
'win32'
);
expect(script).toContain(
'Add-Tool https://github.com/composer/composer/releases/latest/download/composer.phar composer'
'Add-Tool https://getcomposer.org/composer-stable.phar composer'
);
expect(script).toContain(
'Add-Tool https://github.com/staabm/annotate-pull-request-from-checkstyle/releases/latest/download/cs2pr cs2pr'
);
expect(script).toContain(
'Add-Tool https://deployer.org/deployer.phar deployer'
);
expect(script).toContain(
'Add-Composer-Tool prestissimo prestissimo hirak/'
);
expect(script).toContain('Add-Composertool prestissimo prestissimo hirak/');
expect(script).toContain(
'Add-Tool https://github.com/phpmd/phpmd/releases/latest/download/phpmd.phar phpmd'
);
expect(script).toContain('Add-Composer-Tool phinx phinx robmorgan/');
expect(script).toContain('Add-Composertool phinx phinx robmorgan/');
expect(script).toContain(
'Add-Tool https://github.com/phar-io/phive/releases/download/0.13.2/phive-0.13.2.phar phive'
);
Expand All @@ -440,14 +477,12 @@ describe('Tools tests', () => {
'win32'
);
expect(script).toContain(
'Add-Tool https://github.com/composer/composer/releases/latest/download/composer.phar composer'
);
expect(script).toContain(
'Add-Composer-Tool prestissimo prestissimo hirak/'
'Add-Tool https://getcomposer.org/composer-stable.phar composer'
);
expect(script).toContain('Add-Composer-Tool phinx phinx robmorgan/');
expect(script).toContain('Add-Composertool prestissimo prestissimo hirak/');
expect(script).toContain('Add-Composertool phinx phinx robmorgan/');
expect(script).toContain(
'Add-Composer-Tool composer-prefetcher composer-prefetcher narrowspark/automatic-'
'Add-Composertool composer-prefetcher composer-prefetcher narrowspark/automatic-'
);
});
});
1 change: 1 addition & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ author: shivammathur
description: 'Setup PHP with required extensions, php.ini configuration, code-coverage support and various tools like composer'
branding:
color: 'purple'
icon: 'play-circle'
inputs:
php-version:
description: 'Setup PHP version.'
Expand Down
Loading

0 comments on commit 0da52b1

Please sign in to comment.