Skip to content

Commit

Permalink
Merge 0632853 into 0cfd6a5
Browse files Browse the repository at this point in the history
  • Loading branch information
mfaure authored Apr 25, 2020
2 parents 0cfd6a5 + 0632853 commit c8cb730
Showing 1 changed file with 51 additions and 44 deletions.
95 changes: 51 additions & 44 deletions spec/acceptance/php_spec.rb
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
require 'spec_helper_acceptance'

describe 'php with default settings' do
context 'default parameters' do
it 'works with defaults' do
pp = 'include php'
# Run it twice and test for idempotency
describe 'php class' do
context 'with default parameters' do
pp = 'include php'
it 'applies without error' do
apply_manifest(pp, catch_failures: true)
end
it 'applies idempotently' do
apply_manifest(pp, catch_changes: true)
end

Expand All @@ -32,51 +33,56 @@
it { is_expected.to be_enabled }
end
end
context 'default parameters with extensions' do
case default[:platform]
when %r{ubuntu-18.04}, %r{ubuntu-16.04}
it 'works with defaults' do
case default[:platform]
when %r{ubuntu-18.04}
simplexmlpackagename = 'php7.2-xml'
when %r{ubuntu-16.04}
simplexmlpackagename = 'php7.0-xml'
end
pp = <<-EOS
context 'with extensions' do
added_extensions = case default[:platform]
when %r{ubuntu-18.04}
<<-EOS
'bz2' => {},
'curl' => {},
'intl' => {},
'json' => {},
'mbstring' => {},
'zip' => {},
'net-url' => {
package_prefix => 'php-',
settings => {
extension => undef
},
},
'simplexml' => {
package_name => 'php7.2-xml',
},
EOS
when %r{ubuntu-16.04}
<<-EOS
'net-url' => {
package_prefix => 'php-',
settings => {
extension => undef
},
},
'simplexml' => {
package_name => 'php7.0-xml',
},
EOS
else
''
end

pp = <<-EOS
class{'php':
extensions => {
'mysql' => {},
'gd' => {},
'net-url' => {
package_prefix => 'php-',
settings => {
extension => undef
},
},
'simplexml' => {
package_name => '#{simplexmlpackagename}',
}
}
}
EOS
# Run it twice and test for idempotency
apply_manifest(pp, catch_failures: true)
apply_manifest(pp, catch_changes: true)
end
else
it 'works with defaults' do
pp = <<-EOS
class{'php':
extensions => {
'mysql' => {},
'gd' => {}
#{added_extensions}
}
}
EOS
# Run it twice and test for idempotency
apply_manifest(pp, catch_failures: true)
apply_manifest(pp, catch_changes: true)
end
EOS
it 'applies without error' do
apply_manifest(pp, catch_failures: true)
end
it 'applies idempotently' do
apply_manifest(pp, catch_changes: true)
end

case default[:platform]
Expand All @@ -93,6 +99,7 @@
when %r{debian-10}
packagename = 'php7.3-fpm'
end

describe package(packagename) do
it { is_expected.to be_installed }
end
Expand Down

0 comments on commit c8cb730

Please sign in to comment.