Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhance acceptance tests #539

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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