setup-php/__tests__/config.test.ts

53 lines
1.8 KiB
TypeScript
Raw Permalink 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(
2020-05-17 05:09:04 +07:00
'Add-Content "$php_dir\\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',
'openbsd'
2019-10-08 19:42:54 +07:00
);
expect(win32).toContain('Platform openbsd is not supported');
2019-10-08 19:42:54 +07:00
});
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(
2020-12-17 22:19:20 +07:00
'echo "post_max_size=256M\nshort_open_tag=On\ndate.timezone=Asia/Kolkata" | sudo tee -a "${pecl_file:-${ini_file[@]}}"'
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',
'openbsd'
2019-10-08 19:42:54 +07:00
);
expect(linux).toContain('Platform openbsd is not supported');
2019-10-08 19:42:54 +07:00
});
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(
2020-12-17 22:19:20 +07:00
'echo "post_max_size=256M\nshort_open_tag=On\ndate.timezone=Asia/Kolkata" | sudo tee -a "${pecl_file:-${ini_file[@]}}"'
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',
'openbsd'
2019-10-08 19:42:54 +07:00
);
expect(darwin).toContain('Platform openbsd is not supported');
2019-10-08 19:42:54 +07:00
});
});