mirror of
https://github.com/shivammathur/setup-php.git
synced 2024-11-22 11:51:07 +07:00
Add support for coverage: xdebug2
This commit is contained in:
parent
849315646a
commit
e5b90e33c6
@ -30,34 +30,29 @@ describe('Config tests', () => {
|
||||
expect(win32).toContain('Add-Extension xdebug');
|
||||
});
|
||||
|
||||
it('checking addCoverage with Xdebug3 on windows', async () => {
|
||||
const win32: string = await coverage.addCoverage('xdebug3', '7.4', 'win32');
|
||||
expect(win32).toContain('Add-Extension xdebug');
|
||||
});
|
||||
|
||||
it('checking addCoverage with Xdebug2 on windows', async () => {
|
||||
const win32: string = await coverage.addCoverage('xdebug2', '7.4', 'win32');
|
||||
expect(win32).toContain('Add-Extension xdebug stable 2.9.8');
|
||||
});
|
||||
|
||||
it('checking addCoverage with Xdebug on linux', async () => {
|
||||
const linux: string = await coverage.addCoverage('xdebug', '8.0', 'linux');
|
||||
expect(linux).toContain('add_extension xdebug');
|
||||
});
|
||||
|
||||
it('checking addCoverage with Xdebug3 on linux', async () => {
|
||||
const linux: string = await coverage.addCoverage('xdebug3', '7.4', 'linux');
|
||||
expect(linux).toContain('add_extension_from_source xdebug');
|
||||
});
|
||||
|
||||
it('checking addCoverage with Xdebug3 on linux', async () => {
|
||||
const linux: string = await coverage.addCoverage('xdebug3', '8.0', 'linux');
|
||||
expect(linux).toContain('add_extension xdebug');
|
||||
});
|
||||
|
||||
it('checking addCoverage with Xdebug on linux', async () => {
|
||||
const linux: string = await coverage.addCoverage('xdebug', '8.0', 'linux');
|
||||
expect(linux).toContain('add_extension xdebug');
|
||||
});
|
||||
|
||||
it('checking addCoverage with Xdebug3 on linux', async () => {
|
||||
const linux: string = await coverage.addCoverage('xdebug3', '8.1', 'linux');
|
||||
expect(linux).toContain('add_extension xdebug');
|
||||
});
|
||||
|
||||
it('checking addCoverage with Xdebug on linux', async () => {
|
||||
const linux: string = await coverage.addCoverage('xdebug', '8.1', 'linux');
|
||||
expect(linux).toContain('add_extension xdebug');
|
||||
it('checking addCoverage with Xdebug2 on linux', async () => {
|
||||
const linux: string = await coverage.addCoverage('xdebug2', '7.4', 'linux');
|
||||
expect(linux).toContain('add_pecl_extension xdebug 2.9.8 zend_extension');
|
||||
});
|
||||
|
||||
it('checking addCoverage with Xdebug on darwin', async () => {
|
||||
@ -69,6 +64,24 @@ describe('Config tests', () => {
|
||||
expect(darwin).toContain('add_brew_extension xdebug');
|
||||
});
|
||||
|
||||
it('checking addCoverage with Xdebug3 on darwin', async () => {
|
||||
const darwin: string = await coverage.addCoverage(
|
||||
'xdebug3',
|
||||
'7.4',
|
||||
'darwin'
|
||||
);
|
||||
expect(darwin).toContain('add_brew_extension xdebug');
|
||||
});
|
||||
|
||||
it('checking addCoverage with Xdebug2 on darwin', async () => {
|
||||
const darwin: string = await coverage.addCoverage(
|
||||
'xdebug2',
|
||||
'7.4',
|
||||
'darwin'
|
||||
);
|
||||
expect(darwin).toContain('add_brew_extension xdebug2');
|
||||
});
|
||||
|
||||
it('checking disableCoverage windows', async () => {
|
||||
const win32 = await coverage.addCoverage('none', '7.4', 'win32');
|
||||
expect(win32).toContain('Remove-Extension xdebug');
|
||||
|
@ -25,7 +25,7 @@ describe('Extension tests', () => {
|
||||
'Add-Log "$cross" "pcov" "pcov is not supported on PHP 5.6"'
|
||||
);
|
||||
|
||||
win32 = await extensions.addExtension('xdebug', '7.2', 'win32');
|
||||
win32 = await extensions.addExtension('xdebug2', '7.2', 'win32');
|
||||
expect(win32).toContain('Add-Extension xdebug stable 2.9.8');
|
||||
|
||||
win32 = await extensions.addExtension('mysql', '7.4', 'win32');
|
||||
@ -62,13 +62,11 @@ describe('Extension tests', () => {
|
||||
|
||||
it('checking addExtensionOnLinux', async () => {
|
||||
let linux: string = await extensions.addExtension(
|
||||
'Xdebug, xdebug3, pcov, sqlite, :intl, ast, ast-beta, pdo_mysql, pdo-odbc, xdebug-alpha, grpc-1.2.3',
|
||||
'Xdebug, pcov, sqlite, :intl, ast, ast-beta, pdo_mysql, pdo-odbc, xdebug-alpha, grpc-1.2.3',
|
||||
'7.4',
|
||||
'linux'
|
||||
);
|
||||
expect(linux).toContain(
|
||||
'add_extension_from_source xdebug xdebug/xdebug master --enable-xdebug zend_extension'
|
||||
);
|
||||
expect(linux).toContain('add_extension xdebug');
|
||||
expect(linux).toContain('add_extension sqlite3');
|
||||
expect(linux).toContain('remove_extension intl');
|
||||
expect(linux).toContain('add_unstable_extension ast beta extension');
|
||||
@ -99,7 +97,7 @@ describe('Extension tests', () => {
|
||||
linux = await extensions.addExtension('cubrid', '7.4', 'linux');
|
||||
expect(linux).toContain('add_cubrid cubrid');
|
||||
|
||||
linux = await extensions.addExtension('xdebug', '7.2', 'linux');
|
||||
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');
|
||||
@ -194,6 +192,9 @@ describe('Extension tests', () => {
|
||||
darwin = await extensions.addExtension('xdebug', '7.2', 'darwin');
|
||||
expect(darwin).toContain('add_brew_extension xdebug');
|
||||
|
||||
darwin = await extensions.addExtension('xdebug2', '7.2', 'darwin');
|
||||
expect(darwin).toContain('add_brew_extension xdebug2');
|
||||
|
||||
darwin = await extensions.addExtension('redis', '5.6', 'darwin');
|
||||
expect(darwin).toContain('add_extension redis-2.2.8');
|
||||
|
||||
|
38
dist/index.js
vendored
38
dist/index.js
vendored
@ -1275,18 +1275,11 @@ exports.CSVArray = CSVArray;
|
||||
* @param extension
|
||||
*/
|
||||
async function getExtensionPrefix(extension) {
|
||||
const zend = [
|
||||
'xdebug',
|
||||
'xdebug3',
|
||||
'opcache',
|
||||
'ioncube',
|
||||
'eaccelerator'
|
||||
];
|
||||
switch (zend.indexOf(extension)) {
|
||||
switch (true) {
|
||||
default:
|
||||
return 'zend_extension';
|
||||
case -1:
|
||||
return 'extension';
|
||||
case /xdebug([2-3])?$|opcache|ioncube|eaccelerator/.test(extension):
|
||||
return 'zend_extension';
|
||||
}
|
||||
}
|
||||
exports.getExtensionPrefix = getExtensionPrefix;
|
||||
@ -2419,8 +2412,9 @@ async function addCoverage(coverage_driver, version, os_version) {
|
||||
return script + (await addCoveragePCOV(version, os_version, pipe));
|
||||
case 'xdebug':
|
||||
case 'xdebug3':
|
||||
return (script +
|
||||
(await addCoverageXdebug(coverage_driver, version, os_version, pipe)));
|
||||
return (script + (await addCoverageXdebug('xdebug', version, os_version, pipe)));
|
||||
case 'xdebug2':
|
||||
return (script + (await addCoverageXdebug('xdebug2', version, os_version, pipe)));
|
||||
case 'none':
|
||||
return script + (await disableCoverage(version, os_version, pipe));
|
||||
default:
|
||||
@ -2968,10 +2962,11 @@ async function addExtensionWindows(extension_csv, version) {
|
||||
matches = /.*-(\d+\.\d+\.\d)([a-zA-Z+]+)\d*/.exec(version_extension);
|
||||
add_script += await utils.joins('\nAdd-Extension', ext_name, matches[2].replace('preview', 'devel'), matches[1]);
|
||||
break;
|
||||
// match 5.3pcov to 7.0pcov
|
||||
case /7\.2xdebug/.test(version_extension):
|
||||
// match 7.2xdebug2 to 7.4xdebug2
|
||||
case /7\.[2-4]xdebug2/.test(version_extension):
|
||||
add_script += '\nAdd-Extension xdebug stable 2.9.8';
|
||||
break;
|
||||
// match 5.3pcov to 7.0pcov
|
||||
case /(5\.[3-6]|7\.0)pcov/.test(version_extension):
|
||||
add_script += await utils.getUnsupportedLog('pcov', version, 'win32');
|
||||
break;
|
||||
@ -3048,19 +3043,10 @@ async function addExtensionLinux(extension_csv, version) {
|
||||
case /(5\.[3-6]|7\.0)pcov/.test(version_extension):
|
||||
add_script += await utils.getUnsupportedLog('pcov', version, 'linux');
|
||||
return;
|
||||
// match 7.2xdebug3..7.4xdebug3
|
||||
case /^7\.[2-4]xdebug3$/.test(version_extension):
|
||||
add_script +=
|
||||
'\nadd_extension_from_source xdebug xdebug/xdebug master --enable-xdebug zend_extension';
|
||||
// match 7.2xdebug2...7.4xdebug2
|
||||
case /^7\.[2-4]xdebug2$/.test(version_extension):
|
||||
add_script += await utils.joins('\nadd_pecl_extension', 'xdebug', '2.9.8', ext_prefix);
|
||||
return;
|
||||
// match 7.2xdebug
|
||||
case /^7\.2xdebug$/.test(version_extension):
|
||||
add_script += await utils.joins('\nadd_pecl_extension', ext_name, '2.9.8', ext_prefix);
|
||||
break;
|
||||
// match 8.0xdebug3...8.9xdebug3
|
||||
case /^8\.[0-9]xdebug3$/.test(version_extension):
|
||||
extension = 'xdebug';
|
||||
break;
|
||||
// match pdo extensions
|
||||
case /.*pdo[_-].*/.test(version_extension):
|
||||
extension = extension.replace(/pdo[_-]|3/, '');
|
||||
|
@ -140,8 +140,11 @@ export async function addCoverage(
|
||||
case 'xdebug':
|
||||
case 'xdebug3':
|
||||
return (
|
||||
script +
|
||||
(await addCoverageXdebug(coverage_driver, version, os_version, pipe))
|
||||
script + (await addCoverageXdebug('xdebug', version, os_version, pipe))
|
||||
);
|
||||
case 'xdebug2':
|
||||
return (
|
||||
script + (await addCoverageXdebug('xdebug2', version, os_version, pipe))
|
||||
);
|
||||
case 'none':
|
||||
return script + (await disableCoverage(version, os_version, pipe));
|
||||
|
@ -163,10 +163,11 @@ export async function addExtensionWindows(
|
||||
matches[1]
|
||||
);
|
||||
break;
|
||||
// match 5.3pcov to 7.0pcov
|
||||
case /7\.2xdebug/.test(version_extension):
|
||||
// match 7.2xdebug2 to 7.4xdebug2
|
||||
case /7\.[2-4]xdebug2/.test(version_extension):
|
||||
add_script += '\nAdd-Extension xdebug stable 2.9.8';
|
||||
break;
|
||||
// match 5.3pcov to 7.0pcov
|
||||
case /(5\.[3-6]|7\.0)pcov/.test(version_extension):
|
||||
add_script += await utils.getUnsupportedLog('pcov', version, 'win32');
|
||||
break;
|
||||
@ -267,24 +268,15 @@ export async function addExtensionLinux(
|
||||
case /(5\.[3-6]|7\.0)pcov/.test(version_extension):
|
||||
add_script += await utils.getUnsupportedLog('pcov', version, 'linux');
|
||||
return;
|
||||
// match 7.2xdebug3..7.4xdebug3
|
||||
case /^7\.[2-4]xdebug3$/.test(version_extension):
|
||||
add_script +=
|
||||
'\nadd_extension_from_source xdebug xdebug/xdebug master --enable-xdebug zend_extension';
|
||||
return;
|
||||
// match 7.2xdebug
|
||||
case /^7\.2xdebug$/.test(version_extension):
|
||||
// match 7.2xdebug2...7.4xdebug2
|
||||
case /^7\.[2-4]xdebug2$/.test(version_extension):
|
||||
add_script += await utils.joins(
|
||||
'\nadd_pecl_extension',
|
||||
ext_name,
|
||||
'xdebug',
|
||||
'2.9.8',
|
||||
ext_prefix
|
||||
);
|
||||
break;
|
||||
// match 8.0xdebug3...8.9xdebug3
|
||||
case /^8\.[0-9]xdebug3$/.test(version_extension):
|
||||
extension = 'xdebug';
|
||||
break;
|
||||
return;
|
||||
// match pdo extensions
|
||||
case /.*pdo[_-].*/.test(version_extension):
|
||||
extension = extension.replace(/pdo[_-]|3/, '');
|
||||
|
@ -68,8 +68,9 @@ add_brew_tap() {
|
||||
|
||||
# Function to install a php extension from shivammathur/extensions tap.
|
||||
add_brew_extension() {
|
||||
extension=$1
|
||||
formula=$1
|
||||
prefix=$2
|
||||
extension=${formula//[0-9]/}
|
||||
enable_extension "$extension" "$prefix"
|
||||
if check_extension "$extension"; then
|
||||
add_log "${tick:?}" "$extension" "Enabled"
|
||||
@ -77,8 +78,8 @@ add_brew_extension() {
|
||||
add_brew_tap shivammathur/homebrew-php
|
||||
add_brew_tap shivammathur/homebrew-extensions
|
||||
sudo mv "$tap_dir"/shivammathur/homebrew-extensions/.github/deps/"$extension"/* "$tap_dir/homebrew/homebrew-core/Formula/" 2>/dev/null || true
|
||||
brew install "$extension@$version" >/dev/null 2>&1
|
||||
sudo cp "$brew_prefix/opt/$extension@$version/$extension.so" "$ext_dir"
|
||||
brew install "$formula@$version" >/dev/null 2>&1
|
||||
sudo cp "$brew_prefix/opt/$formula@$version/$extension.so" "$ext_dir"
|
||||
add_extension_log "$extension" "Installed and enabled"
|
||||
fi
|
||||
}
|
||||
|
13
src/utils.ts
13
src/utils.ts
@ -262,18 +262,11 @@ export async function CSVArray(values_csv: string): Promise<Array<string>> {
|
||||
* @param extension
|
||||
*/
|
||||
export async function getExtensionPrefix(extension: string): Promise<string> {
|
||||
const zend: Array<string> = [
|
||||
'xdebug',
|
||||
'xdebug3',
|
||||
'opcache',
|
||||
'ioncube',
|
||||
'eaccelerator'
|
||||
];
|
||||
switch (zend.indexOf(extension)) {
|
||||
switch (true) {
|
||||
default:
|
||||
return 'zend_extension';
|
||||
case -1:
|
||||
return 'extension';
|
||||
case /xdebug([2-3])?$|opcache|ioncube|eaccelerator/.test(extension):
|
||||
return 'zend_extension';
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user