From 6555cf043265520739312c777e1f19aa578be163 Mon Sep 17 00:00:00 2001 From: Nicolas Rodriguez Date: Wed, 4 Sep 2019 01:33:06 +0200 Subject: [PATCH] test(config): add tests on Php config --- .../default/controls/config_spec.rb | 46 +++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 test/integration/default/controls/config_spec.rb diff --git a/test/integration/default/controls/config_spec.rb b/test/integration/default/controls/config_spec.rb new file mode 100644 index 00000000..17e26edc --- /dev/null +++ b/test/integration/default/controls/config_spec.rb @@ -0,0 +1,46 @@ +control 'Php configuration' do + title 'should match desired lines' + + def test_debian + describe file('/etc/php/5.6/fpm/pool.d/radius-admin.conf') do + its('content') { should include '[radius-admin]' } + its('content') { should include 'php_admin_value[date.timezone] = Europe/Paris' } + end + + describe file('/etc/php/7.3/fpm/pool.d/ldap-admin.conf') do + its('content') { should include '[ldap-admin]' } + its('content') { should include 'php_admin_value[date.timezone] = Europe/Paris' } + end + + describe file('/etc/php/5.6/fpm/php.ini') do + its('content') { should include 'date.timezone = Europe/Paris' } + end + + describe file('/etc/php/7.3/fpm/php.ini') do + its('content') { should include 'date.timezone = Europe/Paris' } + end + end + + def test_ubuntu + end + + def test_redhat + end + + def test_suse + end + + case os[:family] + when 'debian' + case os[:name] + when 'ubuntu' + test_ubuntu + when 'debian' + test_debian + end + when 'redhat', 'fedora' + test_redhat + when 'suse' + test_suse + end +end