setup-php/__tests__/config.test.ts

53 lines
1.7 KiB
TypeScript
Raw Normal View History

2019-10-08 19:42:54 +07:00
import * as config from '../src/config';
describe('Config tests', () => {
it('checking addINIValuesOnWindows', async () => {
let win32: string = await config.addINIValues(
'post_max_size=256M, short_open_tag=On, date.timezone=Asia/Kolkata',
'win32'
);
expect(win32).toContain(
2019-10-11 06:11:25 +07:00
'Add-Content C:\\tools\\php\\php.ini "post_max_size=256M\nshort_open_tag=On\ndate.timezone=Asia/Kolkata"'
2019-10-08 19:42:54 +07:00
);
win32 = await config.addINIValues(
'post_max_size=256M, short_open_tag=On, date.timezone=Asia/Kolkata',
'fedora'
);
expect(win32).toContain('Platform fedora is not supported');
});
it('checking addINIValuesOnLinux', async () => {
let linux: string = await config.addINIValues(
'post_max_size=256M, short_open_tag=On, date.timezone=Asia/Kolkata',
2019-10-17 03:11:13 +07:00
'linux',
true
2019-10-08 19:42:54 +07:00
);
2019-10-11 06:11:25 +07:00
expect(linux).toContain(
2019-10-27 07:12:49 +07:00
'echo "post_max_size=256M\nshort_open_tag=On\ndate.timezone=Asia/Kolkata"'
2019-10-11 06:11:25 +07:00
);
2019-10-08 19:42:54 +07:00
linux = await config.addINIValues(
'post_max_size=256M, short_open_tag=On, date.timezone=Asia/Kolkata',
'fedora'
);
expect(linux).toContain('Platform fedora is not supported');
});
it('checking addINIValuesOnDarwin', async () => {
let darwin: string = await config.addINIValues(
'post_max_size=256M, short_open_tag=On, date.timezone=Asia/Kolkata',
'darwin'
);
2019-10-11 06:11:25 +07:00
expect(darwin).toContain(
2019-10-27 07:12:49 +07:00
'echo "post_max_size=256M\nshort_open_tag=On\ndate.timezone=Asia/Kolkata"'
2019-10-11 06:11:25 +07:00
);
2019-10-08 19:42:54 +07:00
darwin = await config.addINIValues(
'post_max_size=256M, short_open_tag=On, date.timezone=Asia/Kolkata',
'fedora'
);
expect(darwin).toContain('Platform fedora is not supported');
});
});