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(
|
2020-07-19 12:39:45 +07:00
|
|
|
'Xdebug, pcov, sqlite, :intl, phalcon4, ioncube, oci8, pdo_oci, ast-beta, grpc-1.2.3, inotify-1.2.3alpha2',
|
2019-12-02 22:13:45 +07:00
|
|
|
'7.4',
|
2019-10-08 19:42:54 +07:00
|
|
|
'win32'
|
|
|
|
);
|
2019-11-25 17:53:13 +07:00
|
|
|
expect(win32).toContain('Add-Extension xdebug');
|
|
|
|
expect(win32).toContain('Add-Extension pcov');
|
2020-03-12 06:17:52 +07:00
|
|
|
expect(win32).toContain('Add-Extension sqlite3');
|
2020-05-07 04:57:00 +07:00
|
|
|
expect(win32).toContain('Remove-Extension intl');
|
2019-12-26 20:01:18 +07:00
|
|
|
expect(win32).toContain('phalcon.ps1 phalcon4');
|
2020-07-19 12:39:45 +07:00
|
|
|
expect(win32).toContain('ioncube.ps1 7.4');
|
2020-07-15 11:15:40 +07:00
|
|
|
expect(win32).toContain('oci.ps1 oci8 7.4');
|
|
|
|
expect(win32).toContain('oci.ps1 pdo_oci 7.4');
|
2020-01-26 02:34:09 +07:00
|
|
|
expect(win32).toContain('Add-Extension ast beta');
|
2020-02-14 00:09:00 +07:00
|
|
|
expect(win32).toContain('Add-Extension grpc stable 1.2.3');
|
2020-02-16 01:55:50 +07:00
|
|
|
expect(win32).toContain('Add-Extension inotify alpha 1.2.3');
|
2019-10-08 19:42:54 +07:00
|
|
|
|
2020-07-23 08:17:57 +07:00
|
|
|
win32 = await extensions.addExtension('pcov', '5.6', 'win32');
|
|
|
|
expect(win32).toContain(
|
|
|
|
'Add-Log "$cross" "pcov" "pcov is not supported on PHP 5.6"'
|
|
|
|
);
|
|
|
|
|
2020-03-16 08:23:58 +07:00
|
|
|
win32 = await extensions.addExtension('mysql', '7.4', 'win32');
|
|
|
|
expect(win32).toContain('Add-Extension mysqli');
|
|
|
|
expect(win32).toContain('Add-Extension mysqlnd');
|
|
|
|
|
|
|
|
win32 = await extensions.addExtension('mysql', '8.0', 'win32');
|
|
|
|
expect(win32).toContain('Add-Extension mysqli');
|
|
|
|
expect(win32).toContain('Add-Extension mysqlnd');
|
|
|
|
|
|
|
|
win32 = await extensions.addExtension('mysql', '5.5', 'win32');
|
|
|
|
expect(win32).toContain('Add-Extension mysql');
|
|
|
|
expect(win32).toContain('Add-Extension mysqli');
|
|
|
|
expect(win32).toContain('Add-Extension mysqlnd');
|
|
|
|
|
2019-10-17 03:11:13 +07:00
|
|
|
win32 = await extensions.addExtension(
|
2019-12-24 00:49:38 +07:00
|
|
|
'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');
|
2019-11-25 17:53:13 +07:00
|
|
|
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');
|
2020-02-27 05:59:45 +07:00
|
|
|
|
|
|
|
win32 = await extensions.addExtension('blackfire', '7.3', 'win32');
|
2020-05-07 18:44:15 +07:00
|
|
|
expect(win32).toContain('blackfire.ps1 7.3 blackfire');
|
2020-02-27 05:59:45 +07:00
|
|
|
|
|
|
|
win32 = await extensions.addExtension('blackfire-1.31.0', '7.3', 'win32');
|
2020-05-07 18:44:15 +07:00
|
|
|
expect(win32).toContain('blackfire.ps1 7.3 blackfire-1.31.0');
|
2019-10-08 19:42:54 +07:00
|
|
|
});
|
|
|
|
|
|
|
|
it('checking addExtensionOnLinux', async () => {
|
|
|
|
let linux: string = await extensions.addExtension(
|
2020-06-20 07:55:19 +07:00
|
|
|
'Xdebug, xdebug3, pcov, sqlite, :intl, ast, uopz, ast-beta, pdo_mysql, pdo-odbc, xdebug-alpha, grpc-1.2.3',
|
2019-12-02 22:13:45 +07:00
|
|
|
'7.4',
|
2019-10-08 19:42:54 +07:00
|
|
|
'linux'
|
|
|
|
);
|
2020-06-20 07:55:19 +07:00
|
|
|
expect(linux).toContain(
|
|
|
|
'add_extension_from_source xdebug xdebug/xdebug master --enable-xdebug zend_extension'
|
|
|
|
);
|
2020-03-05 07:28:24 +07:00
|
|
|
expect(linux).toContain('sudo $debconf_fix apt-get install -y php7.4-pcov');
|
2020-03-12 06:17:52 +07:00
|
|
|
expect(linux).toContain(
|
|
|
|
'sudo $debconf_fix apt-get install -y php7.4-sqlite3'
|
|
|
|
);
|
2020-05-07 04:57:00 +07:00
|
|
|
expect(linux).toContain('remove_extension intl');
|
2020-03-30 15:20:20 +07:00
|
|
|
expect(linux).toContain('sudo $debconf_fix apt-get install -y php-ast');
|
|
|
|
expect(linux).toContain('sudo $debconf_fix apt-get install -y php-uopz');
|
2020-01-30 13:33:30 +07:00
|
|
|
expect(linux).toContain('add_unstable_extension ast beta extension');
|
2020-03-05 07:28:24 +07:00
|
|
|
expect(linux).toContain('add_pdo_extension mysql');
|
|
|
|
expect(linux).toContain('add_pdo_extension odbc');
|
2020-02-23 20:30:40 +07:00
|
|
|
expect(linux).toContain('add_pecl_extension grpc 1.2.3 extension');
|
2020-01-30 13:33:30 +07:00
|
|
|
expect(linux).toContain(
|
|
|
|
'add_unstable_extension xdebug alpha zend_extension'
|
|
|
|
);
|
2019-10-08 19:42:54 +07:00
|
|
|
|
2020-06-20 07:55:19 +07:00
|
|
|
linux = await extensions.addExtension('xdebug3', '8.0', 'linux');
|
|
|
|
expect(linux).toContain(
|
|
|
|
'sudo $debconf_fix apt-get install -y php8.0-xdebug'
|
|
|
|
);
|
|
|
|
|
2020-07-23 08:17:57 +07:00
|
|
|
linux = await extensions.addExtension('pcov', '5.6', 'linux');
|
|
|
|
expect(linux).toContain(
|
|
|
|
'add_log "$cross" "pcov" "pcov is not supported on PHP 5.6"'
|
|
|
|
);
|
|
|
|
|
2019-12-14 09:45:39 +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');
|
|
|
|
|
2020-01-20 22:37:51 +07:00
|
|
|
linux = await extensions.addExtension('gearman', '7.2', 'linux');
|
2019-12-14 09:45:39 +07:00
|
|
|
expect(linux).toContain('gearman.sh 7.2');
|
2019-10-13 11:18:29 +07:00
|
|
|
|
2020-01-20 22:37:51 +07:00
|
|
|
linux = await extensions.addExtension('gearman', '7.3', 'linux');
|
2019-12-14 09:45:39 +07:00
|
|
|
expect(linux).toContain('gearman.sh 7.3');
|
2019-10-13 11:18:29 +07:00
|
|
|
|
2020-01-21 02:20:38 +07:00
|
|
|
linux = await extensions.addExtension('gearman', '7.4', 'linux');
|
2019-12-14 09:45:39 +07:00
|
|
|
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');
|
2020-01-21 19:28:09 +07:00
|
|
|
|
|
|
|
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');
|
2020-02-26 04:09:10 +07:00
|
|
|
|
2020-07-19 12:39:45 +07:00
|
|
|
linux = await extensions.addExtension('ioncube', '7.3', 'linux');
|
|
|
|
expect(linux).toContain('ioncube.sh 7.3');
|
|
|
|
|
2020-07-15 11:15:40 +07:00
|
|
|
linux = await extensions.addExtension('oci8, pdo_oci', '7.3', 'linux');
|
|
|
|
expect(linux).toContain('oci.sh oci8 7.3');
|
|
|
|
expect(linux).toContain('oci.sh pdo_oci 7.3');
|
|
|
|
|
2020-02-26 04:09:10 +07:00
|
|
|
linux = await extensions.addExtension('blackfire', '7.3', 'linux');
|
2020-05-07 18:44:15 +07:00
|
|
|
expect(linux).toContain('blackfire.sh 7.3 blackfire');
|
2020-02-26 04:09:10 +07:00
|
|
|
|
|
|
|
linux = await extensions.addExtension('blackfire-1.31.0', '7.3', 'linux');
|
2020-05-07 18:44:15 +07:00
|
|
|
expect(linux).toContain('blackfire.sh 7.3 blackfire-1.31.0');
|
2019-10-08 19:42:54 +07:00
|
|
|
});
|
|
|
|
|
|
|
|
it('checking addExtensionOnDarwin', async () => {
|
|
|
|
let darwin: string = await extensions.addExtension(
|
2020-07-15 11:15:40 +07:00
|
|
|
'Xdebug, pcov, grpc, protobuf, swoole, sqlite, oci8, pdo_oci, :intl, ast-beta, grpc-1.2.3',
|
2019-10-08 19:42:54 +07:00
|
|
|
'7.2',
|
|
|
|
'darwin'
|
|
|
|
);
|
2020-06-19 05:39:13 +07:00
|
|
|
expect(darwin).toContain('add_brew_extension xdebug');
|
|
|
|
expect(darwin).toContain('add_brew_extension pcov');
|
2020-06-27 10:58:20 +07:00
|
|
|
expect(darwin).toContain('add_brew_extension grpc');
|
|
|
|
expect(darwin).toContain('add_brew_extension protobuf');
|
|
|
|
expect(darwin).toContain('add_brew_extension swoole');
|
2020-03-12 06:17:52 +07:00
|
|
|
expect(darwin).toContain('sudo pecl install -f sqlite3');
|
2020-05-07 04:57:00 +07:00
|
|
|
expect(darwin).toContain('remove_extension intl');
|
2020-01-30 13:33:30 +07:00
|
|
|
expect(darwin).toContain('add_unstable_extension ast beta extension');
|
2020-02-23 20:30:40 +07:00
|
|
|
expect(darwin).toContain('add_pecl_extension grpc 1.2.3 extension');
|
2019-10-08 19:42:54 +07:00
|
|
|
|
2019-12-24 00:49:38 +07:00
|
|
|
darwin = await extensions.addExtension('phalcon3', '7.0', 'darwin');
|
2019-12-31 07:16:33 +07:00
|
|
|
expect(darwin).toContain('phalcon_darwin.sh phalcon3 7.0');
|
2019-12-24 00:49:38 +07:00
|
|
|
|
|
|
|
darwin = await extensions.addExtension('phalcon4', '7.3', 'darwin');
|
2019-12-31 07:16:33 +07:00
|
|
|
expect(darwin).toContain('phalcon_darwin.sh phalcon4 7.3');
|
2019-12-24 00:49:38 +07:00
|
|
|
|
2020-07-19 12:39:45 +07:00
|
|
|
darwin = await extensions.addExtension('ioncube', '7.3', 'darwin');
|
|
|
|
expect(darwin).toContain('ioncube.sh 7.3');
|
|
|
|
|
2020-07-15 11:15:40 +07:00
|
|
|
darwin = await extensions.addExtension('oci8, pdo_oci', '7.3', 'darwin');
|
|
|
|
expect(darwin).toContain('oci.sh oci8 7.3');
|
|
|
|
expect(darwin).toContain('oci.sh pdo_oci 7.3');
|
|
|
|
|
2019-10-08 19:42:54 +07:00
|
|
|
darwin = await extensions.addExtension('pcov', '5.6', 'darwin');
|
2020-07-23 08:17:57 +07:00
|
|
|
expect(darwin).toContain(
|
|
|
|
'add_log "$cross" "pcov" "pcov is not supported on PHP 5.6"'
|
|
|
|
);
|
2019-10-08 19:42:54 +07:00
|
|
|
|
|
|
|
darwin = await extensions.addExtension('pcov', '7.2', 'darwin');
|
2020-06-19 05:39:13 +07:00
|
|
|
expect(darwin).toContain('add_brew_extension pcov');
|
2019-10-08 19:42:54 +07:00
|
|
|
|
2020-02-05 22:28:44 +07:00
|
|
|
darwin = await extensions.addExtension('xdebug', '5.3', 'darwin');
|
|
|
|
expect(darwin).toContain('sudo pecl install -f xdebug-2.2.7');
|
|
|
|
|
|
|
|
darwin = await extensions.addExtension('xdebug', '5.4', 'darwin');
|
|
|
|
expect(darwin).toContain('sudo pecl install -f xdebug-2.4.1');
|
|
|
|
|
|
|
|
darwin = await extensions.addExtension('xdebug', '5.5', 'darwin');
|
|
|
|
expect(darwin).toContain('sudo pecl install -f xdebug-2.5.5');
|
|
|
|
|
2019-10-08 19:42:54 +07:00
|
|
|
darwin = await extensions.addExtension('xdebug', '5.6', 'darwin');
|
2020-06-19 05:39:13 +07:00
|
|
|
expect(darwin).toContain('add_brew_extension xdebug');
|
2019-10-08 19:42:54 +07:00
|
|
|
|
2020-01-17 07:21:46 +07:00
|
|
|
darwin = await extensions.addExtension('xdebug', '7.0', 'darwin');
|
2020-06-19 05:39:13 +07:00
|
|
|
expect(darwin).toContain('add_brew_extension xdebug');
|
2020-01-17 07:21:46 +07:00
|
|
|
|
2019-10-08 19:42:54 +07:00
|
|
|
darwin = await extensions.addExtension('xdebug', '7.2', 'darwin');
|
2020-06-19 05:39:13 +07:00
|
|
|
expect(darwin).toContain('add_brew_extension 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');
|
2020-01-26 02:34:09 +07:00
|
|
|
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');
|
2020-01-26 02:34:09 +07:00
|
|
|
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');
|
2020-01-26 02:34:09 +07:00
|
|
|
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');
|
2020-01-26 02:34:09 +07:00
|
|
|
expect(darwin).toContain('sudo pecl install -f imagick');
|
2020-01-21 02:36:31 +07:00
|
|
|
|
2020-02-27 05:59:45 +07:00
|
|
|
darwin = await extensions.addExtension('blackfire', '7.3', 'darwin');
|
2020-05-07 18:44:15 +07:00
|
|
|
expect(darwin).toContain('blackfire_darwin.sh 7.3 blackfire');
|
2020-02-27 05:59:45 +07:00
|
|
|
|
|
|
|
darwin = await extensions.addExtension('blackfire-1.31.0', '7.3', 'darwin');
|
2020-05-07 18:44:15 +07:00
|
|
|
expect(darwin).toContain('blackfire_darwin.sh 7.3 blackfire-1.31.0');
|
2020-02-27 05:59:45 +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');
|
|
|
|
});
|
|
|
|
});
|