Setup Xdebug 2.9.8 on PHP 7.2

This commit is contained in:
Shivam Mathur 2020-11-26 23:50:49 +05:30
parent 2fc508f43d
commit 46b357b6c2
No known key found for this signature in database
GPG Key ID: 3E13E4C8591ACC2A
5 changed files with 36 additions and 25 deletions

View File

@ -13,6 +13,9 @@ describe('Extension tests', () => {
expect(win32).toContain('phalcon.ps1 phalcon4');
expect(win32).toContain('Add-Extension ast beta');
win32 = await extensions.addExtension('xdebug', '7.2', 'win32');
expect(win32).toContain('Add-Extension xdebug stable 2.9.8');
win32 = await extensions.addExtension('mysql', '7.4', 'win32');
expect(win32).toContain('Add-Extension mysqli');
expect(win32).toContain('Add-Extension mysqlnd');
@ -68,6 +71,9 @@ describe('Extension tests', () => {
linux = await extensions.addExtension('gearman', '7.4', 'linux');
expect(linux).toContain('gearman.sh 7.4');
linux = await extensions.addExtension('xdebug', '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');

View File

@ -35,11 +35,12 @@ describe('Utils tests', () => {
it('checking asyncForEach', async () => {
const array: Array<string> = ['a', 'b', 'c'];
let concat = '';
await utils.asyncForEach(array, async function (
str: string
): Promise<void> {
concat += str;
});
await utils.asyncForEach(
array,
async function (str: string): Promise<void> {
concat += str;
}
);
expect(concat).toBe('abc');
});
@ -76,12 +77,12 @@ describe('Utils tests', () => {
const runner_dir: string = process.env['RUNNER_TOOL_CACHE'] || '';
const script_path: string = path.join(runner_dir, 'test.sh');
await utils.writeScript('test.sh', testString);
await fs.readFile(script_path, function (
error: Error | null,
data: Buffer
) {
expect(testString).toBe(data.toString());
});
await fs.readFile(
script_path,
function (error: Error | null, data: Buffer) {
expect(testString).toBe(data.toString());
}
);
await cleanup(script_path);
});

16
dist/index.js vendored
View File

@ -2152,13 +2152,7 @@ async function addCoverageXdebug(version, os_version, pipe) {
const xdebug = (await extensions.addExtension('xdebug', version, os_version, true)) + pipe;
const ini = await config.addINIValues('xdebug.mode=coverage', os_version, true);
const log = await utils.addLog('$tick', 'xdebug', 'Xdebug enabled as coverage driver', os_version);
switch (true) {
case /8.[0-9]/.test(version):
return xdebug + '\n' + ini + '\n' + log;
case /5\.[3-6]|7.[0-4]/.test(version):
default:
return xdebug + '\n' + log;
}
return xdebug + '\n' + ini + '\n' + log;
}
exports.addCoverageXdebug = addCoverageXdebug;
/**
@ -2791,6 +2785,10 @@ async function addExtensionWindows(extension_csv, version) {
script +=
'\nAdd-Extension mysql\nAdd-Extension mysqli\nAdd-Extension mysqlnd';
break;
// match 7.2xdebug
case /7\.2xdebug/.test(version_extension):
script += '\nAdd-Extension xdebug stable 2.9.8';
break;
// match 7.0mysql..8.0mysql
// match 7.0mysqli..8.0mysqli
// match 7.0mysqlnd..8.0mysqlnd
@ -2867,6 +2865,10 @@ async function addExtensionLinux(extension_csv, version, pipe) {
' ' +
version;
return;
// match 7.2xdebug
case /^7\.2xdebug$/.test(version_extension):
script += '\nadd_pecl_extension xdebug 2.9.8 ' + ext_prefix;
return;
// match sqlite
case /^sqlite$/.test(extension):
extension = 'sqlite3';

View File

@ -27,13 +27,7 @@ export async function addCoverageXdebug(
'Xdebug enabled as coverage driver',
os_version
);
switch (true) {
case /8.[0-9]/.test(version):
return xdebug + '\n' + ini + '\n' + log;
case /5\.[3-6]|7.[0-4]/.test(version):
default:
return xdebug + '\n' + log;
}
return xdebug + '\n' + ini + '\n' + log;
}
/**

View File

@ -99,6 +99,10 @@ export async function addExtensionWindows(
script +=
'\nAdd-Extension mysql\nAdd-Extension mysqli\nAdd-Extension mysqlnd';
break;
// match 7.2xdebug
case /7\.2xdebug/.test(version_extension):
script += '\nAdd-Extension xdebug stable 2.9.8';
break;
// match 7.0mysql..8.0mysql
// match 7.0mysqli..8.0mysqli
// match 7.0mysqlnd..8.0mysqlnd
@ -179,6 +183,10 @@ export async function addExtensionLinux(
' ' +
version;
return;
// match 7.2xdebug
case /^7\.2xdebug$/.test(version_extension):
script += '\nadd_pecl_extension xdebug 2.9.8 ' + ext_prefix;
return;
// match sqlite
case /^sqlite$/.test(extension):
extension = 'sqlite3';