diff --git a/spec/acceptance/php_spec.rb b/spec/acceptance/php_spec.rb index 01ab0a5c..0230d139 100644 --- a/spec/acceptance/php_spec.rb +++ b/spec/acceptance/php_spec.rb @@ -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 @@ -34,71 +35,66 @@ 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 - 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 - when %r{ubuntu-14.04} - it 'works with defaults' do - pp = <<-EOS + context 'with extensions' do + added_extensions = case default[:platform] + when %r{ubuntu-18.04} + <<-EOS + 'bz2' => {}, + 'curl' => {}, + 'intl' => {}, + 'json' => {}, + 'mbstring' => {}, + 'posix' => {}, + '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 + when %r{ubuntu-14.04} + <<-EOS + 'net-url' => { + package_prefix => 'php-', + settings => { + extension => undef + }, + }, + EOS + else + '' + end + + pp = <<-EOS class{'php': extensions => { 'mysql' => {}, 'gd' => {}, - 'net-url' => { - package_prefix => 'php-', - settings => { - extension => undef - }, - } + #{added_extensions} } } - 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' => {} - } - } - 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] @@ -117,6 +113,7 @@ when %r{debian-10} packagename = 'php7.3-fpm' end + describe package(packagename) do it { is_expected.to be_installed } end