|
25 | 25 | 'php5-cli' |
26 | 26 | end |
27 | 27 | end |
28 | | - php_fpm_ackage = case facts[:os]['name'] |
29 | | - when 'Debian' |
30 | | - case facts[:os]['release']['major'] |
31 | | - when '9' |
32 | | - 'php7.0-fpm' |
33 | | - else |
34 | | - 'php5-fpm' |
35 | | - end |
36 | | - when 'Ubuntu' |
37 | | - case facts[:os]['release']['major'] |
38 | | - when '18.04' |
39 | | - 'php7.2-fpm' |
40 | | - when '16.04' |
41 | | - 'php7.0-fpm' |
42 | | - else |
43 | | - 'php5-fpm' |
44 | | - end |
45 | | - end |
46 | | - php_dev_ackage = case facts[:os]['name'] |
47 | | - when 'Debian' |
48 | | - case facts[:os]['release']['major'] |
49 | | - when '9' |
50 | | - 'php7.0-dev' |
51 | | - else |
52 | | - 'php5-dev' |
53 | | - end |
54 | | - when 'Ubuntu' |
55 | | - case facts[:os]['release']['major'] |
56 | | - when '18.04' |
57 | | - 'php7.2-dev' |
58 | | - when '16.04' |
59 | | - 'php7.0-dev' |
60 | | - else |
61 | | - 'php5-dev' |
62 | | - end |
63 | | - end |
| 28 | + php_fpm_package = case facts[:os]['name'] |
| 29 | + when 'Debian' |
| 30 | + case facts[:os]['release']['major'] |
| 31 | + when '9' |
| 32 | + 'php7.0-fpm' |
| 33 | + else |
| 34 | + 'php5-fpm' |
| 35 | + end |
| 36 | + when 'Ubuntu' |
| 37 | + case facts[:os]['release']['major'] |
| 38 | + when '18.04' |
| 39 | + 'php7.2-fpm' |
| 40 | + when '16.04' |
| 41 | + 'php7.0-fpm' |
| 42 | + else |
| 43 | + 'php5-fpm' |
| 44 | + end |
| 45 | + end |
| 46 | + php_dev_package = case facts[:os]['name'] |
| 47 | + when 'Debian' |
| 48 | + case facts[:os]['release']['major'] |
| 49 | + when '9' |
| 50 | + 'php7.0-dev' |
| 51 | + else |
| 52 | + 'php5-dev' |
| 53 | + end |
| 54 | + when 'Ubuntu' |
| 55 | + case facts[:os]['release']['major'] |
| 56 | + when '18.04' |
| 57 | + 'php7.2-dev' |
| 58 | + when '16.04' |
| 59 | + 'php7.0-dev' |
| 60 | + else |
| 61 | + 'php5-dev' |
| 62 | + end |
| 63 | + end |
64 | 64 |
|
65 | 65 | describe 'when called with no parameters' do |
66 | 66 | case facts[:osfamily] |
|
75 | 75 | it { is_expected.to contain_package('php-pear').with_ensure('present') } |
76 | 76 | it { is_expected.to contain_class('php::composer') } |
77 | 77 | it { is_expected.to contain_package(php_cli_package).with_ensure('present') } |
78 | | - it { is_expected.to contain_package(php_fpm_ackage).with_ensure('present') } |
79 | | - it { is_expected.to contain_package(php_dev_ackage).with_ensure('present') } |
| 78 | + it { is_expected.to contain_package(php_fpm_package).with_ensure('present') } |
| 79 | + it { is_expected.to contain_package(php_dev_package).with_ensure('present') } |
80 | 80 | when 'Suse' |
81 | 81 | it { is_expected.to contain_package('php5').with_ensure('present') } |
82 | 82 | it { is_expected.to contain_package('php5-devel').with_ensure('present') } |
|
90 | 90 | end |
91 | 91 | end |
92 | 92 |
|
| 93 | + describe 'when called with extensions' do |
| 94 | + let(:params) { { extensions: { xml: {} } } } |
| 95 | + |
| 96 | + it { is_expected.to contain_php__extension('xml').with_ensure('present') } |
| 97 | + end |
| 98 | + |
| 99 | + describe 'when called with ensure absent and extensions' do |
| 100 | + extensions = { xml: {} } |
| 101 | + let(:params) { { ensure: 'absent', extensions: extensions } } |
| 102 | + |
| 103 | + it { is_expected.to contain_php__extension('xml').with_ensure('absent') } |
| 104 | + |
| 105 | + case facts[:osfamily] |
| 106 | + when 'Debian' |
| 107 | + it { is_expected.to contain_package(php_cli_package).with_ensure('absent') } |
| 108 | + it { is_expected.to contain_package(php_fpm_package).with_ensure('absent') } |
| 109 | + it { is_expected.to contain_package(php_dev_package).with_ensure('absent') } |
| 110 | + when 'Suse' |
| 111 | + it { is_expected.to contain_package('php5').with_ensure('absent') } |
| 112 | + it { is_expected.to contain_package('php5-devel').with_ensure('absent') } |
| 113 | + when 'RedHat', 'CentOS' |
| 114 | + it { is_expected.to contain_package('php-cli').with_ensure('absent') } |
| 115 | + it { is_expected.to contain_package('php-common').with_ensure('absent') } |
| 116 | + end |
| 117 | + end |
| 118 | + |
93 | 119 | describe 'when called with package_prefix parameter' do |
94 | 120 | package_prefix = 'myphp-' |
95 | 121 | let(:params) { { package_prefix: package_prefix } } |
|
0 commit comments