mirror of
https://github.com/shivammathur/setup-php.git
synced 2024-11-23 04:11:06 +07:00
139 lines
8.3 KiB
TypeScript
139 lines
8.3 KiB
TypeScript
import * as fs from 'fs';
|
|
import * as extensions from '../src/extensions';
|
|
|
|
describe('Extension tests', () => {
|
|
it.each`
|
|
extension | version | output
|
|
${'none'} | ${'7.4'} | ${'Disable-AllShared'}
|
|
${':intl'} | ${'7.4'} | ${'Disable-Extension intl'}
|
|
${'ast-beta'} | ${'7.4'} | ${'Add-Extension ast beta'}
|
|
${'blackfire'} | ${'7.3'} | ${'Add-Blackfire blackfire'}
|
|
${'blackfire-1.31.0'} | ${'7.3'} | ${'Add-Blackfire blackfire-1.31.0'}
|
|
${'grpc-1.2.3'} | ${'7.4'} | ${'Add-Extension grpc stable 1.2.3'}
|
|
${'inotify-1.2.3alpha2'} | ${'7.4'} | ${'Add-Extension inotify alpha 1.2.3'}
|
|
${'ioncube'} | ${'7.4'} | ${'Add-Ioncube'}
|
|
${'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"'}
|
|
${'mysql'} | ${'7.4'} | ${'Add-Extension mysqli\nAdd-Extension mysqlnd'}
|
|
${'mysql'} | ${'5.5'} | ${'Add-Extension mysql\nAdd-Extension mysqli\nAdd-Extension mysqlnd'}
|
|
${'oci8'} | ${'7.4'} | ${'Add-Oci oci8'}
|
|
${'pcov'} | ${'5.6'} | ${'Add-Log "$cross" "pcov" "pcov is not supported on PHP 5.6"'}
|
|
${'pdo_oci'} | ${'7.4'} | ${'Add-Oci pdo_oci'}
|
|
${'pecl_http'} | ${'7.4'} | ${'Add-Http'}
|
|
${'phalcon3'} | ${'7.2'} | ${'Add-Phalcon phalcon3'}
|
|
${'phalcon4'} | ${'7.4'} | ${'Add-Phalcon phalcon4'}
|
|
${'sqlite'} | ${'7.4'} | ${'Add-Extension sqlite3'}
|
|
${'sqlsrv-1.2.3preview1'} | ${'7.4'} | ${'Add-Extension sqlsrv devel 1.2.3'}
|
|
${'Xdebug'} | ${'7.4'} | ${'Add-Extension xdebug'}
|
|
${'xdebug2'} | ${'7.2'} | ${'Add-Extension xdebug stable 2.9.8'}
|
|
`(
|
|
'checking addExtensionOnWindows for extension $extension on version $version',
|
|
async ({extension, version, output}) => {
|
|
expect(
|
|
await extensions.addExtension(extension, version, 'win32')
|
|
).toContain(output);
|
|
}
|
|
);
|
|
|
|
it.each`
|
|
extension | version | output
|
|
${'none'} | ${'7.4'} | ${'disable_all_shared'}
|
|
${':intl'} | ${'7.4'} | ${'disable_extension intl'}
|
|
${'ast-beta'} | ${'7.4'} | ${'add_unstable_extension ast beta extension'}
|
|
${'blackfire'} | ${'7.3'} | ${'add_blackfire blackfire'}
|
|
${'blackfire-1.31.0'} | ${'7.3'} | ${'add_blackfire blackfire-1.31.0'}
|
|
${'couchbase'} | ${'7.4'} | ${'add_couchbase'}
|
|
${'gearman'} | ${'5.6'} | ${'add_gearman'}
|
|
${'geos'} | ${'7.3'} | ${'add_geos'}
|
|
${'grpc-1.2.3'} | ${'7.4'} | ${'add_pecl_extension grpc 1.2.3 extension'}
|
|
${'http-1.2.3'} | ${'7.3'} | ${'add_http http-1.2.3'}
|
|
${'intl-65.1'} | ${'5.6'} | ${'add_intl intl-65.1'}
|
|
${'ioncube'} | ${'7.3'} | ${'add_ioncube'}
|
|
${'mongodb-mongodb/mongo-php-driver@master'} | ${'7.3'} | ${'add_extension_from_source mongodb https://github.com mongodb mongo-php-driver master extension'}
|
|
${'oci8'} | ${'7.3'} | ${'add_oci oci8'}
|
|
${'pcov'} | ${'5.6'} | ${'add_log "$cross" "pcov" "pcov is not supported on PHP 5.6'}
|
|
${'pdo-odbc'} | ${'7.4'} | ${'add_pdo_extension odbc'}
|
|
${'pdo_cubrid'} | ${'7.0'} | ${'add_cubrid pdo_cubrid'}
|
|
${'pdo_cubrid'} | ${'7.4'} | ${'add_pdo_extension cubrid'}
|
|
${'pdo_mysql'} | ${'7.4'} | ${'add_pdo_extension mysql'}
|
|
${'pdo_oci'} | ${'7.3'} | ${'add_oci pdo_oci'}
|
|
${'pecl_http'} | ${'7.3'} | ${'add_http'}
|
|
${'phalcon3'} | ${'7.3'} | ${'add_phalcon phalcon3'}
|
|
${'sqlite'} | ${'7.4'} | ${'add_extension sqlite3'}
|
|
${'Xdebug'} | ${'7.4'} | ${'add_extension xdebug'}
|
|
${'xdebug-alpha'} | ${'7.4'} | ${'add_unstable_extension xdebug alpha zend_extension'}
|
|
${'xdebug2'} | ${'7.2'} | ${'add_pecl_extension xdebug 2.9.8 zend_extension'}
|
|
`(
|
|
'checking addExtensionOnLinux for extension $extension on version $version',
|
|
async ({extension, version, output}) => {
|
|
expect(
|
|
await extensions.addExtension(extension, version, 'linux')
|
|
).toContain(output);
|
|
}
|
|
);
|
|
|
|
it.each`
|
|
extension | version | output
|
|
${'none'} | ${'7.2'} | ${'disable_all_shared'}
|
|
${':intl'} | ${'7.2'} | ${'disable_extension intl'}
|
|
${'ast-beta'} | ${'7.2'} | ${'add_unstable_extension ast beta extension'}
|
|
${'blackfire'} | ${'7.3'} | ${'add_blackfire blackfire'}
|
|
${'blackfire-1.31.0'} | ${'7.3'} | ${'add_blackfire blackfire-1.31.0'}
|
|
${'couchbase'} | ${'5.6'} | ${'add_couchbase'}
|
|
${'does_not_exist'} | ${'7.2'} | ${'add_extension does_not_exist'}
|
|
${'geos'} | ${'7.3'} | ${'add_geos'}
|
|
${'grpc-1.2.3'} | ${'7.2'} | ${'add_pecl_extension grpc 1.2.3 extension'}
|
|
${'http-1.2.3'} | ${'7.3'} | ${'add_http http-1.2.3'}
|
|
${'imagick'} | ${'5.5'} | ${'add_extension imagick'}
|
|
${'ioncube'} | ${'7.3'} | ${'add_ioncube'}
|
|
${'mongodb-mongodb/mongo-php-driver@master'} | ${'7.2'} | ${'add_extension_from_source mongodb https://github.com mongodb mongo-php-driver master extension'}
|
|
${'oci8'} | ${'7.3'} | ${'add_oci oci8'}
|
|
${'pcov'} | ${'5.6'} | ${'add_log "$cross" "pcov" "pcov is not supported on PHP 5.6"'}
|
|
${'pdo_oci'} | ${'7.3'} | ${'add_oci pdo_oci'}
|
|
${'pecl_http'} | ${'7.3'} | ${'add_http'}
|
|
${'sqlite'} | ${'7.2'} | ${'add_extension sqlite3'}
|
|
`(
|
|
'checking addExtensionOnDarwin for extension $extension on version $version',
|
|
async ({extension, version, output}) => {
|
|
expect(
|
|
await extensions.addExtension(extension, version, 'darwin')
|
|
).toContain(output);
|
|
}
|
|
);
|
|
|
|
const data: string[][] = fs
|
|
.readFileSync('src/configs/brew_extensions')
|
|
.toString()
|
|
.split(/\r?\n/)
|
|
.filter(Boolean)
|
|
.map(line => {
|
|
const [formula, extension]: string[] = line.split('=');
|
|
const prefix: string =
|
|
extension == 'xdebug' ? 'zend_extension' : 'extension';
|
|
const output: string = fs.existsSync(`src/scripts/ext/${extension}.sh`)
|
|
? `add_${extension}`
|
|
: `add_brew_extension ${formula} ${prefix}`;
|
|
return [formula, '7.3', output];
|
|
});
|
|
|
|
it.each(data)(
|
|
'checking addExtensionOnDarwin for brew extension %s',
|
|
async (extension, version, output) => {
|
|
expect(
|
|
await extensions.addExtension(extension, version, 'darwin')
|
|
).toContain(output);
|
|
}
|
|
);
|
|
|
|
it.each`
|
|
extension | version | output
|
|
${'xdebug'} | ${'7.2'} | ${'Platform openbsd is not supported'}
|
|
`(
|
|
'checking addExtension on openbsd for extension $extension on version $version',
|
|
async ({extension, version, output}) => {
|
|
expect(
|
|
await extensions.addExtension(extension, version, 'openbsd')
|
|
).toContain(output);
|
|
}
|
|
);
|
|
});
|