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

View File

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

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

View File

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

View File

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