setup-php/__tests__/extensions.test.ts

119 lines
4.4 KiB
TypeScript
Raw Normal View History

2019-10-08 19:42:54 +07:00
import * as extensions from '../src/extensions';
describe('Extension tests', () => {
it('checking addExtensionOnWindows', async () => {
let win32: string = await extensions.addExtension(
'xdebug, pcov, phalcon4, ast-beta',
2019-12-02 22:13:45 +07:00
'7.4',
2019-10-08 19:42:54 +07:00
'win32'
);
expect(win32).toContain('Add-Extension xdebug');
expect(win32).toContain('Add-Extension pcov');
2019-12-26 20:01:18 +07:00
expect(win32).toContain('phalcon.ps1 phalcon4');
expect(win32).toContain('Add-Extension ast beta');
2019-10-08 19:42:54 +07:00
2019-10-17 03:11:13 +07:00
win32 = await extensions.addExtension(
'phalcon3, does_not_exist',
2019-10-17 03:11:13 +07:00
'7.2',
'win32',
true
);
2019-12-26 20:01:18 +07:00
expect(win32).toContain('phalcon.ps1 phalcon3');
expect(win32).toContain('Add-Extension does_not_exist');
2019-10-08 19:42:54 +07:00
win32 = await extensions.addExtension('xdebug', '7.2', 'fedora');
expect(win32).toContain('Platform fedora is not supported');
});
it('checking addExtensionOnLinux', async () => {
let linux: string = await extensions.addExtension(
'xdebug, pcov, ast-beta',
2019-12-02 22:13:45 +07:00
'7.4',
2019-10-08 19:42:54 +07:00
'linux'
);
expect(linux).toContain('update_extension xdebug 2.9.0');
2019-10-08 19:42:54 +07:00
expect(linux).toContain(
2019-12-02 22:13:45 +07:00
'sudo DEBIAN_FRONTEND=noninteractive apt-get install -y php7.4-pcov'
2019-10-08 19:42:54 +07:00
);
expect(linux).toContain('install_extension ast-beta');
2019-10-08 19:42:54 +07:00
linux = await extensions.addExtension('gearman', '7.0', 'linux');
expect(linux).toContain('gearman.sh 7.0');
linux = await extensions.addExtension('gearman', '7.1', 'linux');
expect(linux).toContain('gearman.sh 7.1');
linux = await extensions.addExtension('gearman', '7.2', 'linux');
expect(linux).toContain('gearman.sh 7.2');
2019-10-13 11:18:29 +07:00
linux = await extensions.addExtension('gearman', '7.3', 'linux');
expect(linux).toContain('gearman.sh 7.3');
2019-10-13 11:18:29 +07:00
linux = await extensions.addExtension('gearman', '7.4', 'linux');
expect(linux).toContain('gearman.sh 7.4');
2019-12-02 22:13:45 +07:00
2019-10-08 19:42:54 +07:00
linux = await extensions.addExtension('xdebug', '7.2', 'fedora');
expect(linux).toContain('Platform fedora is not supported');
linux = await extensions.addExtension('phalcon3, phalcon4', '7.3', 'linux');
expect(linux).toContain('phalcon.sh phalcon3 7.3');
expect(linux).toContain('phalcon.sh phalcon4 7.3');
2019-10-08 19:42:54 +07:00
});
it('checking addExtensionOnDarwin', async () => {
let darwin: string = await extensions.addExtension(
'xdebug, pcov, ast-beta',
2019-10-08 19:42:54 +07:00
'7.2',
'darwin'
);
expect(darwin).toContain('sudo pecl install -f xdebug');
expect(darwin).toContain('sudo pecl install -f pcov');
expect(darwin).toContain('install_extension ast-beta');
2019-10-08 19:42:54 +07:00
darwin = await extensions.addExtension('phalcon3', '7.0', 'darwin');
expect(darwin).toContain('phalcon_darwin.sh phalcon3 7.0');
darwin = await extensions.addExtension('phalcon4', '7.3', 'darwin');
expect(darwin).toContain('phalcon_darwin.sh phalcon4 7.3');
2019-10-08 19:42:54 +07:00
darwin = await extensions.addExtension('pcov', '5.6', 'darwin');
expect(darwin).toContain('sudo pecl install -f pcov');
2019-10-08 19:42:54 +07:00
darwin = await extensions.addExtension('pcov', '7.2', 'darwin');
expect(darwin).toContain('sudo pecl install -f pcov');
2019-10-08 19:42:54 +07:00
darwin = await extensions.addExtension('xdebug', '5.6', 'darwin');
expect(darwin).toContain('sudo pecl install -f xdebug-2.5.5');
2019-10-08 19:42:54 +07:00
2020-01-17 07:21:46 +07:00
darwin = await extensions.addExtension('xdebug', '7.0', 'darwin');
expect(darwin).toContain('sudo pecl install -f xdebug-2.9.0');
2020-01-17 07:21:46 +07:00
2019-10-08 19:42:54 +07:00
darwin = await extensions.addExtension('xdebug', '7.2', 'darwin');
expect(darwin).toContain('sudo pecl install -f xdebug');
2019-10-08 19:42:54 +07:00
2019-12-02 22:13:45 +07:00
darwin = await extensions.addExtension('redis', '5.6', 'darwin');
expect(darwin).toContain('sudo pecl install -f redis-2.2.8');
2019-12-02 22:13:45 +07:00
darwin = await extensions.addExtension('redis', '7.2', 'darwin');
expect(darwin).toContain('sudo pecl install -f redis');
2019-12-02 22:13:45 +07:00
2020-01-21 02:36:31 +07:00
darwin = await extensions.addExtension('imagick', '5.6', 'darwin');
expect(darwin).toContain('brew install pkg-config imagemagick');
expect(darwin).toContain('sudo pecl install -f imagick');
2020-01-21 02:36:31 +07:00
darwin = await extensions.addExtension('imagick', '7.4', 'darwin');
expect(darwin).toContain('brew install pkg-config imagemagick');
expect(darwin).toContain('sudo pecl install -f imagick');
2020-01-21 02:36:31 +07:00
2019-10-17 03:11:13 +07:00
darwin = await extensions.addExtension(
'does_not_exist',
'7.2',
'darwin',
false
);
2019-10-11 06:11:25 +07:00
expect(darwin).toContain('add_extension does_not_exist');
2019-10-08 19:42:54 +07:00
darwin = await extensions.addExtension('xdebug', '7.2', 'fedora');
expect(darwin).toContain('Platform fedora is not supported');
});
});