|
3 | 3 | require 'spec_helper_acceptance'
|
4 | 4 | apache_hash = apache_settings_hash
|
5 | 5 |
|
6 |
| -describe 'apache::mod::php class', if: mod_supported_on_platform?('apache::mod::php') do |
7 |
| - context 'default php config' do |
8 |
| - pp = <<-MANIFEST |
9 |
| - class { 'apache': |
10 |
| - mpm_module => 'prefork', |
11 |
| - } |
12 |
| - class { 'apache::mod::php': } |
13 |
| - apache::vhost { 'php.example.com': |
14 |
| - port => '80', |
15 |
| - docroot => '#{apache_hash['doc_root']}/php', |
16 |
| - } |
17 |
| - host { 'php.example.com': ip => '127.0.0.1', } |
18 |
| - file { '#{apache_hash['doc_root']}/php/index.php': |
19 |
| - ensure => file, |
20 |
| - content => "<?php phpinfo(); ?>\\n", |
21 |
| - } |
22 |
| - MANIFEST |
23 |
| - it 'succeeds in puppeting php' do |
24 |
| - apply_manifest(pp, catch_failures: true) |
25 |
| - end |
26 |
| - |
27 |
| - if os[:family] == 'debian' && os[:release] =~ %r{^9\.} |
28 |
| - describe file("#{apache_hash['mod_dir']}/php7.0.conf") do |
29 |
| - it { is_expected.to contain 'DirectoryIndex index.php' } |
30 |
| - end |
31 |
| - elsif os[:family] == 'debian' && os[:release] =~ %r{^10\.} |
32 |
| - describe file("#{apache_hash['mod_dir']}/php7.3.conf") do |
33 |
| - it { is_expected.to contain 'DirectoryIndex index.php' } |
34 |
| - end |
35 |
| - elsif os[:family] == 'debian' && os[:release] =~ %r{^11\.} |
36 |
| - describe file("#{apache_hash['mod_dir']}/php7.4.conf") do |
37 |
| - it { is_expected.to contain 'DirectoryIndex index.php' } |
38 |
| - end |
39 |
| - elsif os[:family] == 'ubuntu' && os[:release] == '18.04' |
40 |
| - describe file("#{apache_hash['mod_dir']}/php7.2.conf") do |
41 |
| - it { is_expected.to contain 'DirectoryIndex index.php' } |
42 |
| - end |
43 |
| - elsif os[:family] == 'ubuntu' && os[:release] == '20.04' |
44 |
| - describe file("#{apache_hash['mod_dir']}/php7.4.conf") do |
45 |
| - it { is_expected.to contain 'DirectoryIndex index.php' } |
46 |
| - end |
47 |
| - elsif os[:family] == 'redhat' && os[:release] =~ %r{^(9)\b} |
48 |
| - describe file("#{apache_hash['mod_dir']}/php.conf") do |
49 |
| - it { is_expected.to contain 'DirectoryIndex index.php' } |
| 6 | +# Temporary exclusion pending resolution of https://github.com/puppetlabs/puppetlabs-apache/issues/2261 |
| 7 | +unless os[:family] == 'redhat' && os[:release].to_i == 9 |
| 8 | + describe 'apache::mod::php class', if: mod_supported_on_platform?('apache::mod::php') do |
| 9 | + context 'default php config' do |
| 10 | + pp = <<-MANIFEST |
| 11 | + class { 'apache': |
| 12 | + mpm_module => 'prefork', |
| 13 | + } |
| 14 | + class { 'apache::mod::php': } |
| 15 | + apache::vhost { 'php.example.com': |
| 16 | + port => '80', |
| 17 | + docroot => '#{apache_hash['doc_root']}/php', |
| 18 | + } |
| 19 | + host { 'php.example.com': ip => '127.0.0.1', } |
| 20 | + file { '#{apache_hash['doc_root']}/php/index.php': |
| 21 | + ensure => file, |
| 22 | + content => "<?php phpinfo(); ?>\\n", |
| 23 | + } |
| 24 | + MANIFEST |
| 25 | + it 'succeeds in puppeting php' do |
| 26 | + apply_manifest(pp, catch_failures: true) |
50 | 27 | end
|
51 |
| - elsif os[:family] == 'redhat' && os[:release] =~ %r{^(8)\b} |
52 |
| - describe file("#{apache_hash['mod_dir']}/php7.conf") do |
53 |
| - it { is_expected.to contain 'DirectoryIndex index.php' } |
54 |
| - end |
55 |
| - elsif os[:family] == 'sles' && os[:release].to_i >= 15 |
56 |
| - describe file("#{apache_hash['mod_dir']}/php7.conf") do |
57 |
| - it { is_expected.to contain 'DirectoryIndex index.php' } |
58 |
| - end |
59 |
| - else |
60 |
| - describe file("#{apache_hash['mod_dir']}/php5.conf") do |
61 |
| - it { is_expected.to contain 'DirectoryIndex index.php' } |
| 28 | + |
| 29 | + if os[:family] == 'debian' && os[:release] =~ %r{^9\.} |
| 30 | + describe file("#{apache_hash['mod_dir']}/php7.0.conf") do |
| 31 | + it { is_expected.to contain 'DirectoryIndex index.php' } |
| 32 | + end |
| 33 | + elsif os[:family] == 'debian' && os[:release] =~ %r{^10\.} |
| 34 | + describe file("#{apache_hash['mod_dir']}/php7.3.conf") do |
| 35 | + it { is_expected.to contain 'DirectoryIndex index.php' } |
| 36 | + end |
| 37 | + elsif os[:family] == 'debian' && os[:release] =~ %r{^11\.} |
| 38 | + describe file("#{apache_hash['mod_dir']}/php7.4.conf") do |
| 39 | + it { is_expected.to contain 'DirectoryIndex index.php' } |
| 40 | + end |
| 41 | + elsif os[:family] == 'ubuntu' && os[:release] == '18.04' |
| 42 | + describe file("#{apache_hash['mod_dir']}/php7.2.conf") do |
| 43 | + it { is_expected.to contain 'DirectoryIndex index.php' } |
| 44 | + end |
| 45 | + elsif os[:family] == 'ubuntu' && os[:release] == '20.04' |
| 46 | + describe file("#{apache_hash['mod_dir']}/php7.4.conf") do |
| 47 | + it { is_expected.to contain 'DirectoryIndex index.php' } |
| 48 | + end |
| 49 | + elsif os[:family] == 'redhat' && os[:release] =~ %r{^(9)\b} |
| 50 | + describe file("#{apache_hash['mod_dir']}/php.conf") do |
| 51 | + it { is_expected.to contain 'DirectoryIndex index.php' } |
| 52 | + end |
| 53 | + elsif os[:family] == 'redhat' && os[:release] =~ %r{^(8)\b} |
| 54 | + describe file("#{apache_hash['mod_dir']}/php7.conf") do |
| 55 | + it { is_expected.to contain 'DirectoryIndex index.php' } |
| 56 | + end |
| 57 | + elsif os[:family] == 'sles' && os[:release].to_i >= 15 |
| 58 | + describe file("#{apache_hash['mod_dir']}/php7.conf") do |
| 59 | + it { is_expected.to contain 'DirectoryIndex index.php' } |
| 60 | + end |
| 61 | + else |
| 62 | + describe file("#{apache_hash['mod_dir']}/php5.conf") do |
| 63 | + it { is_expected.to contain 'DirectoryIndex index.php' } |
| 64 | + end |
62 | 65 | end
|
63 | 66 | end
|
64 |
| - end |
65 | 67 |
|
66 |
| - context 'custom extensions, php_flag, php_value, php_admin_flag, and php_admin_value' do |
67 |
| - pp = <<-MANIFEST |
68 |
| - class { 'apache': |
69 |
| - mpm_module => 'prefork', |
| 68 | + context 'custom extensions, php_flag, php_value, php_admin_flag, and php_admin_value' do |
| 69 | + pp = <<-MANIFEST |
| 70 | + class { 'apache': |
| 71 | + mpm_module => 'prefork', |
| 72 | + } |
| 73 | + class { 'apache::mod::php': |
| 74 | + extensions => ['.php','.php5'], |
70 | 75 | }
|
71 |
| - class { 'apache::mod::php': |
72 |
| - extensions => ['.php','.php5'], |
73 |
| - } |
74 | 76 |
|
75 |
| - apache::vhost { 'php.example.com': |
76 |
| - port => '80', |
77 |
| - docroot => '#{apache_hash['doc_root']}/php', |
78 |
| - php_values => { 'include_path' => '.:/usr/share/pear:/usr/bin/php', }, |
79 |
| - php_flags => { 'display_errors' => 'on', }, |
80 |
| - php_admin_values => { 'open_basedir' => '/var/www/php/:/usr/share/pear/', }, |
81 |
| - php_admin_flags => { 'engine' => 'on', }, |
82 |
| - } |
83 |
| - host { 'php.example.com': ip => '127.0.0.1', } |
84 |
| - file { '#{apache_hash['doc_root']}/php/index.php5': |
85 |
| - ensure => file, |
86 |
| - content => "<?php phpinfo(); ?>\\n", |
87 |
| - } |
88 |
| - MANIFEST |
89 |
| - it 'succeeds in puppeting php' do |
90 |
| - apply_manifest(pp, catch_failures: true) |
91 |
| - end |
| 77 | + apache::vhost { 'php.example.com': |
| 78 | + port => '80', |
| 79 | + docroot => '#{apache_hash['doc_root']}/php', |
| 80 | + php_values => { 'include_path' => '.:/usr/share/pear:/usr/bin/php', }, |
| 81 | + php_flags => { 'display_errors' => 'on', }, |
| 82 | + php_admin_values => { 'open_basedir' => '/var/www/php/:/usr/share/pear/', }, |
| 83 | + php_admin_flags => { 'engine' => 'on', }, |
| 84 | + } |
| 85 | + host { 'php.example.com': ip => '127.0.0.1', } |
| 86 | + file { '#{apache_hash['doc_root']}/php/index.php5': |
| 87 | + ensure => file, |
| 88 | + content => "<?php phpinfo(); ?>\\n", |
| 89 | + } |
| 90 | + MANIFEST |
| 91 | + it 'succeeds in puppeting php' do |
| 92 | + apply_manifest(pp, catch_failures: true) |
| 93 | + end |
92 | 94 |
|
93 |
| - describe file("#{apache_hash['vhost_dir']}/25-php.example.com.conf") do |
94 |
| - it { is_expected.to contain ' php_flag display_errors on' } |
95 |
| - it { is_expected.to contain ' php_value include_path ".:/usr/share/pear:/usr/bin/php"' } |
96 |
| - it { is_expected.to contain ' php_admin_flag engine on' } |
97 |
| - it { is_expected.to contain ' php_admin_value open_basedir /var/www/php/:/usr/share/pear/' } |
| 95 | + describe file("#{apache_hash['vhost_dir']}/25-php.example.com.conf") do |
| 96 | + it { is_expected.to contain ' php_flag display_errors on' } |
| 97 | + it { is_expected.to contain ' php_value include_path ".:/usr/share/pear:/usr/bin/php"' } |
| 98 | + it { is_expected.to contain ' php_admin_flag engine on' } |
| 99 | + it { is_expected.to contain ' php_admin_value open_basedir /var/www/php/:/usr/share/pear/' } |
| 100 | + end |
98 | 101 | end
|
99 | 102 | end
|
100 | 103 | end
|
0 commit comments