mirror of
https://github.com/shivammathur/setup-php.git
synced 2025-09-08 05:44:07 +07:00
Refactor installation scripts
This commit is contained in:
@ -1,12 +1,5 @@
|
||||
import * as extensions from '../src/extensions';
|
||||
|
||||
let valid_extensions = ['xdebug', 'pcov'];
|
||||
jest.mock('../src/pecl', () => ({
|
||||
checkPECLExtension: jest.fn().mockImplementation(extension => {
|
||||
return valid_extensions.indexOf(extension) !== -1;
|
||||
})
|
||||
}));
|
||||
|
||||
describe('Extension tests', () => {
|
||||
it('checking addExtensionOnWindows', async () => {
|
||||
let win32: string = await extensions.addExtension(
|
||||
@ -27,7 +20,9 @@ describe('Extension tests', () => {
|
||||
expect(win32).toContain('Install-PhpExtension pcov');
|
||||
|
||||
win32 = await extensions.addExtension('does_not_exist', '7.2', 'win32');
|
||||
expect(win32).toContain('Could not find does_not_exist for PHP7.2 on PECL');
|
||||
expect(win32).toContain(
|
||||
'Add-Extension does_not_exist "Install-PhpExtension does_not_exist" extension "Add Extension"'
|
||||
);
|
||||
|
||||
win32 = await extensions.addExtension('xdebug', '7.2', 'fedora');
|
||||
expect(win32).toContain('Platform fedora is not supported');
|
||||
@ -82,9 +77,7 @@ describe('Extension tests', () => {
|
||||
expect(darwin).toContain('sudo pecl install xdebug');
|
||||
|
||||
darwin = await extensions.addExtension('does_not_exist', '7.2', 'darwin');
|
||||
expect(darwin).toContain(
|
||||
'Could not find does_not_exist for PHP7.2 on PECL'
|
||||
);
|
||||
expect(darwin).toContain('add_extension does_not_exist');
|
||||
|
||||
darwin = await extensions.addExtension('xdebug', '7.2', 'fedora');
|
||||
expect(darwin).toContain('Platform fedora is not supported');
|
||||
|
Reference in New Issue
Block a user