setup-php/__tests__/extensions.test.ts

87 lines
2.9 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',
'7.2',
'win32'
);
expect(win32).toContain('Add-Extension xdebug');
expect(win32).toContain('Add-Extension pcov');
2019-10-08 19:42:54 +07:00
win32 = await extensions.addExtension('xdebug, pcov', '7.4', 'win32');
expect(win32).toContain('Add-Extension xdebug');
2019-10-08 19:42:54 +07:00
2019-10-17 03:11:13 +07:00
win32 = await extensions.addExtension(
'does_not_exist',
'7.2',
'win32',
true
);
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',
'7.2',
'linux'
);
expect(linux).toContain(
2019-11-07 12:41:35 +07:00
'sudo DEBIAN_FRONTEND=noninteractive apt-get install -y php7.2-xdebug'
2019-10-08 19:42:54 +07:00
);
2019-11-07 12:41:35 +07:00
expect(linux).toContain('pecl install xdebug');
2019-10-08 19:42:54 +07:00
expect(linux).toContain(
2019-11-07 12:41:35 +07:00
'sudo DEBIAN_FRONTEND=noninteractive apt-get install -y php7.2-pcov'
2019-10-08 19:42:54 +07:00
);
2019-11-07 12:41:35 +07:00
expect(linux).toContain('pecl install pcov');
2019-10-08 19:42:54 +07:00
2019-10-13 11:18:29 +07:00
linux = await extensions.addExtension('phalcon3, phalcon4', '7.2', 'linux');
2019-10-27 07:12:49 +07:00
expect(linux).toContain('phalcon.sh master 7.2');
expect(linux).toContain('phalcon.sh 4.0.x 7.2');
2019-10-13 11:18:29 +07:00
linux = await extensions.addExtension('phalcon3, phalcon4', '7.3', 'linux');
2019-10-27 07:12:49 +07:00
expect(linux).toContain('phalcon.sh master 7.3');
expect(linux).toContain('phalcon.sh 4.0.x 7.3');
2019-10-13 11:18:29 +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');
});
it('checking addExtensionOnDarwin', async () => {
let darwin: string = await extensions.addExtension(
'xdebug, pcov',
'7.2',
'darwin'
);
expect(darwin).toContain('sudo pecl install xdebug');
expect(darwin).toContain('sudo pecl install pcov');
darwin = await extensions.addExtension('pcov', '5.6', 'darwin');
expect(darwin).toContain('sudo pecl install pcov');
darwin = await extensions.addExtension('pcov', '7.2', 'darwin');
expect(darwin).toContain('sudo pecl install pcov');
darwin = await extensions.addExtension('xdebug', '5.6', 'darwin');
expect(darwin).toContain('sudo pecl install xdebug-2.5.5');
darwin = await extensions.addExtension('xdebug', '7.2', 'darwin');
expect(darwin).toContain('sudo pecl install xdebug');
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');
});
});