mirror of
https://github.com/shivammathur/setup-php.git
synced 2024-11-26 13:23:05 +07:00
tests: refactor extensions test to use jest-each
This commit is contained in:
parent
4ce6f3c3df
commit
2cc925b655
@ -1,163 +1,71 @@
|
|||||||
import * as extensions from '../src/extensions';
|
import * as extensions from '../src/extensions';
|
||||||
|
|
||||||
describe('Extension tests', () => {
|
describe('Extension tests', () => {
|
||||||
it('checking addExtensionOnWindows', async () => {
|
it.each`
|
||||||
let win32: string = await extensions.addExtension(
|
extension | version | output
|
||||||
'none, Xdebug, pcov, sqlite, :intl, phalcon4, pecl_http, ioncube, oci8, pdo_oci, ast-beta, grpc-1.2.3, inotify-1.2.3alpha2, sqlsrv-1.2.3preview1',
|
${'none'} | ${'7.4'} | ${'Disable-AllShared'}
|
||||||
'7.4',
|
${'Xdebug'} | ${'7.4'} | ${'Add-Extension xdebug'}
|
||||||
'win32'
|
${':intl'} | ${'7.4'} | ${'Disable-Extension intl'}
|
||||||
);
|
${'phalcon4'} | ${'7.4'} | ${'Add-Phalcon phalcon4'}
|
||||||
expect(win32).toContain('Disable-AllShared');
|
${'pecl_http'} | ${'7.4'} | ${'Add-Http'}
|
||||||
expect(win32).toContain('Add-Extension xdebug');
|
${'ioncube'} | ${'7.4'} | ${'Add-Ioncube'}
|
||||||
expect(win32).toContain('Add-Extension pcov');
|
${'oci8'} | ${'7.4'} | ${'Add-Oci oci8'}
|
||||||
expect(win32).toContain('Add-Extension sqlite3');
|
${'pdo_oci'} | ${'7.4'} | ${'Add-Oci pdo_oci'}
|
||||||
expect(win32).toContain('Disable-Extension intl');
|
${'ast-beta'} | ${'7.4'} | ${'Add-Extension ast beta'}
|
||||||
expect(win32).toContain('Add-Phalcon phalcon4');
|
${'grpc-1.2.3'} | ${'7.4'} | ${'Add-Extension grpc stable 1.2.3'}
|
||||||
expect(win32).toContain('Add-Http');
|
${'inotify-1.2.3alpha2'} | ${'7.4'} | ${'Add-Extension inotify alpha 1.2.3'}
|
||||||
expect(win32).toContain('Add-Ioncube');
|
${'sqlsrv-1.2.3preview1'} | ${'7.4'} | ${'Add-Extension sqlsrv devel 1.2.3'}
|
||||||
expect(win32).toContain('Add-Oci oci8');
|
${'pcov'} | ${'5.6'} | ${'Add-Log "$cross" "pcov" "pcov is not supported on PHP 5.6"'}
|
||||||
expect(win32).toContain('Add-Oci pdo_oci');
|
${'xdebug2'} | ${'7.2'} | ${'Add-Extension xdebug stable 2.9.8'}
|
||||||
expect(win32).toContain('Add-Extension ast beta');
|
${'mysql'} | ${'7.4'} | ${'Add-Extension mysqli'}
|
||||||
expect(win32).toContain('Add-Extension grpc stable 1.2.3');
|
${'mysql'} | ${'7.4'} | ${'Add-Extension mysqlnd'}
|
||||||
expect(win32).toContain('Add-Extension inotify alpha 1.2.3');
|
${'mysql'} | ${'5.5'} | ${'Add-Extension mysql'}
|
||||||
expect(win32).toContain('Add-Extension sqlsrv devel 1.2.3');
|
${'mysql'} | ${'5.5'} | ${'Add-Extension mysqli'}
|
||||||
|
${'mysql'} | ${'5.5'} | ${'Add-Extension mysqlnd'}
|
||||||
|
${'phalcon3'} | ${'7.2'} | ${'Add-Phalcon phalcon3'}
|
||||||
|
${'blackfire'} | ${'7.3'} | ${'Add-Blackfire blackfire'}
|
||||||
|
${'blackfire-1.31.0'} | ${'7.3'} | ${'Add-Blackfire blackfire-1.31.0'}
|
||||||
|
${'mongodb-mongodb/mongo-php-driver@master'} | ${'7.3'} | ${'Add-Log "$cross" "mongodb-mongodb/mongo-php-driver@master" "mongodb-mongodb/mongo-php-driver@master is not supported on PHP 7.3"'}
|
||||||
|
`(
|
||||||
|
'checking addExtensionOnWindows for extension $extension on version $version',
|
||||||
|
async ({extension, version, output}) => {
|
||||||
|
expect(
|
||||||
|
await extensions.addExtension(extension, version, 'win32')
|
||||||
|
).toContain(output);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
win32 = await extensions.addExtension('pcov', '5.6', 'win32');
|
it.each`
|
||||||
expect(win32).toContain(
|
extension | version | output
|
||||||
'Add-Log "$cross" "pcov" "pcov is not supported on PHP 5.6"'
|
${'none'} | ${'7.4'} | ${'disable_all_shared'}
|
||||||
);
|
${'Xdebug'} | ${'7.4'} | ${'add_extension xdebug'}
|
||||||
|
${':intl'} | ${'7.4'} | ${'disable_extension intl'}
|
||||||
win32 = await extensions.addExtension('xdebug2', '7.2', 'win32');
|
${'ast-beta'} | ${'7.4'} | ${'add_unstable_extension ast beta extension'}
|
||||||
expect(win32).toContain('Add-Extension xdebug stable 2.9.8');
|
${'pdo_mysql'} | ${'7.4'} | ${'add_pdo_extension mysql'}
|
||||||
|
${'pdo-odbc'} | ${'7.4'} | ${'add_pdo_extension odbc'}
|
||||||
win32 = await extensions.addExtension('mysql', '7.4', 'win32');
|
${'grpc-1.2.3'} | ${'7.4'} | ${'add_pecl_extension grpc 1.2.3 extension'}
|
||||||
expect(win32).toContain('Add-Extension mysqli');
|
${'xdebug-alpha'} | ${'7.4'} | ${'add_unstable_extension xdebug alpha zend_extension'}
|
||||||
expect(win32).toContain('Add-Extension mysqlnd');
|
${'pcov'} | ${'5.6'} | ${'add_log "$cross" "pcov" "pcov is not supported on PHP 5.6'}
|
||||||
|
${'gearman'} | ${'5.6'} | ${'add_gearman'}
|
||||||
win32 = await extensions.addExtension('mysql', '8.0', 'win32');
|
${'gearman'} | ${'7.4'} | ${'add_gearman'}
|
||||||
expect(win32).toContain('Add-Extension mysqli');
|
${'couchbase'} | ${'5.6'} | ${'add_couchbase'}
|
||||||
expect(win32).toContain('Add-Extension mysqlnd');
|
${'couchbase'} | ${'7.4'} | ${'add_couchbase'}
|
||||||
|
${'pdo_cubrid'} | ${'7.0'} | ${'add_cubrid pdo_cubrid'}
|
||||||
win32 = await extensions.addExtension('mysql', '5.5', 'win32');
|
${'pdo_cubrid'} | ${'7.4'} | ${'add_pdo_extension cubrid'}
|
||||||
expect(win32).toContain('Add-Extension mysql');
|
${'xdebug2'} | ${'7.2'} | ${'add_pecl_extension xdebug 2.9.8 zend_extension'}
|
||||||
expect(win32).toContain('Add-Extension mysqli');
|
${'phalcon3'} | ${'7.3'} | ${'add_phalcon phalcon3'}
|
||||||
expect(win32).toContain('Add-Extension mysqlnd');
|
${'ioncube'} | ${'7.3'} | ${'add_ioncube'}
|
||||||
|
${'geos'} | ${'7.3'} | ${'add_geos'}
|
||||||
win32 = await extensions.addExtension(
|
${'pecl_http'} | ${'7.3'} | ${'add_http'}
|
||||||
'phalcon3, does_not_exist',
|
${'http-1.2.3'} | ${'7.3'} | ${'add_http http-1.2.3'}
|
||||||
'7.2',
|
${'oci8'} | ${'7.3'} | ${'add_oci oci8'}
|
||||||
'win32',
|
${'pdo_oci'} | ${'7.3'} | ${'add_oci pdo_oci'}
|
||||||
true
|
${'blackfire'} | ${'7.3'} | ${'add_blackfire blackfire'}
|
||||||
);
|
${'blackfire-1.31.0'} | ${'7.3'} | ${'add_blackfire blackfire-1.31.0'}
|
||||||
expect(win32).toContain('Add-Phalcon phalcon3');
|
${'intl-65.1'} | ${'5.6'} | ${'add_intl intl-65.1'}
|
||||||
expect(win32).toContain('Add-Extension does_not_exist');
|
${'mongodb-mongodb/mongo-php-driver@master'} | ${'7.3'} | ${'add_extension_from_source mongodb https://github.com mongodb mongo-php-driver master extension'}
|
||||||
|
`('checking addExtensionOnLinux for extension $extension on version $version', async ({extension, version, output}) => {
|
||||||
win32 = await extensions.addExtension('xdebug', '7.2', 'openbsd');
|
expect(await extensions.addExtension(extension, version, 'linux')).toContain(output);
|
||||||
expect(win32).toContain('Platform openbsd is not supported');
|
|
||||||
|
|
||||||
win32 = await extensions.addExtension('blackfire', '7.3', 'win32');
|
|
||||||
expect(win32).toContain('Add-Blackfire blackfire');
|
|
||||||
|
|
||||||
win32 = await extensions.addExtension('blackfire-1.31.0', '7.3', 'win32');
|
|
||||||
expect(win32).toContain('Add-Blackfire blackfire-1.31.0');
|
|
||||||
|
|
||||||
win32 = await extensions.addExtension(
|
|
||||||
'mongodb-mongodb/mongo-php-driver@master',
|
|
||||||
'7.3',
|
|
||||||
'win32'
|
|
||||||
);
|
|
||||||
expect(win32).toContain(
|
|
||||||
'Add-Log "$cross" "mongodb-mongodb/mongo-php-driver@master" "mongodb-mongodb/mongo-php-driver@master is not supported on PHP 7.3"'
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('checking addExtensionOnLinux', async () => {
|
|
||||||
let linux: string = await extensions.addExtension(
|
|
||||||
'none, Xdebug, pcov, sqlite, :intl, ast, ast-beta, pdo_mysql, pdo-odbc, xdebug-alpha, grpc-1.2.3',
|
|
||||||
'7.4',
|
|
||||||
'linux'
|
|
||||||
);
|
|
||||||
expect(linux).toContain('disable_all_shared');
|
|
||||||
expect(linux).toContain('add_extension xdebug');
|
|
||||||
expect(linux).toContain('add_extension sqlite3');
|
|
||||||
expect(linux).toContain('disable_extension intl');
|
|
||||||
expect(linux).toContain('add_unstable_extension ast beta extension');
|
|
||||||
expect(linux).toContain('add_pdo_extension mysql');
|
|
||||||
expect(linux).toContain('add_pdo_extension odbc');
|
|
||||||
expect(linux).toContain('add_pecl_extension grpc 1.2.3 extension');
|
|
||||||
expect(linux).toContain(
|
|
||||||
'add_unstable_extension xdebug alpha zend_extension'
|
|
||||||
);
|
|
||||||
|
|
||||||
linux = await extensions.addExtension('pcov', '5.6', 'linux');
|
|
||||||
expect(linux).toContain(
|
|
||||||
'add_log "$cross" "pcov" "pcov is not supported on PHP 5.6"'
|
|
||||||
);
|
|
||||||
|
|
||||||
linux = await extensions.addExtension('gearman', '5.6', 'linux');
|
|
||||||
expect(linux).toContain('add_gearman');
|
|
||||||
linux = await extensions.addExtension('gearman', '7.4', 'linux');
|
|
||||||
expect(linux).toContain('add_gearman');
|
|
||||||
|
|
||||||
linux = await extensions.addExtension('couchbase', '5.6', 'linux');
|
|
||||||
expect(linux).toContain('add_couchbase');
|
|
||||||
linux = await extensions.addExtension('couchbase', '7.4', 'linux');
|
|
||||||
expect(linux).toContain('add_couchbase');
|
|
||||||
|
|
||||||
linux = await extensions.addExtension('pdo_cubrid', '7.0', 'linux');
|
|
||||||
expect(linux).toContain('add_cubrid pdo_cubrid');
|
|
||||||
linux = await extensions.addExtension('cubrid', '7.4', 'linux');
|
|
||||||
expect(linux).toContain('add_cubrid cubrid');
|
|
||||||
|
|
||||||
linux = await extensions.addExtension('xdebug2', '7.2', 'linux');
|
|
||||||
expect(linux).toContain('add_pecl_extension xdebug 2.9.8 zend_extension');
|
|
||||||
|
|
||||||
linux = await extensions.addExtension('xdebug', '7.2', 'openbsd');
|
|
||||||
expect(linux).toContain('Platform openbsd is not supported');
|
|
||||||
|
|
||||||
linux = await extensions.addExtension('phalcon3, phalcon4', '7.3', 'linux');
|
|
||||||
expect(linux).toContain('add_phalcon phalcon3');
|
|
||||||
expect(linux).toContain('add_phalcon phalcon4');
|
|
||||||
|
|
||||||
linux = await extensions.addExtension('ioncube', '7.3', 'linux');
|
|
||||||
expect(linux).toContain('add_ioncube');
|
|
||||||
|
|
||||||
linux = await extensions.addExtension('geos', '7.3', 'linux');
|
|
||||||
expect(linux).toContain('add_geos');
|
|
||||||
|
|
||||||
linux = await extensions.addExtension('pecl_http', '7.3', 'linux');
|
|
||||||
expect(linux).toContain('add_http');
|
|
||||||
|
|
||||||
linux = await extensions.addExtension('http-1.2.3', '7.3', 'linux');
|
|
||||||
expect(linux).toContain('add_http http-1.2.3');
|
|
||||||
|
|
||||||
linux = await extensions.addExtension('oci8, pdo_oci', '7.3', 'linux');
|
|
||||||
expect(linux).toContain('add_oci oci8');
|
|
||||||
expect(linux).toContain('add_oci pdo_oci');
|
|
||||||
|
|
||||||
linux = await extensions.addExtension('blackfire', '7.3', 'linux');
|
|
||||||
expect(linux).toContain('add_blackfire blackfire');
|
|
||||||
|
|
||||||
linux = await extensions.addExtension('blackfire-1.31.0', '7.3', 'linux');
|
|
||||||
expect(linux).toContain('add_blackfire blackfire-1.31.0');
|
|
||||||
|
|
||||||
linux = await extensions.addExtension('intl-65.1', '5.6', 'linux');
|
|
||||||
expect(linux).toContain('add_intl intl-65.1');
|
|
||||||
|
|
||||||
linux = await extensions.addExtension('intl-67.1', '7.3', 'linux');
|
|
||||||
expect(linux).toContain('add_intl intl-67.1');
|
|
||||||
|
|
||||||
linux = await extensions.addExtension('intl-68.2', '8.0', 'linux');
|
|
||||||
expect(linux).toContain('add_intl intl-68.2');
|
|
||||||
|
|
||||||
linux = await extensions.addExtension(
|
|
||||||
'mongodb-mongodb/mongo-php-driver@master',
|
|
||||||
'7.3',
|
|
||||||
'linux'
|
|
||||||
);
|
|
||||||
expect(linux).toContain(
|
|
||||||
'add_extension_from_source mongodb https://github.com mongodb mongo-php-driver master extension'
|
|
||||||
);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('checking addExtensionOnDarwin', async () => {
|
it('checking addExtensionOnDarwin', async () => {
|
||||||
|
Loading…
Reference in New Issue
Block a user