|
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' } |
| 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) |
46 | 27 | end |
47 | | - elsif os[:family] == 'redhat' && os[:release] =~ %r{^8\b} |
48 | | - describe file("#{apache_hash['mod_dir']}/php7.conf") do |
49 | | - it { is_expected.to contain 'DirectoryIndex index.php' } |
50 | | - end |
51 | | - elsif os[:family] == 'sles' && os[:release].to_i >= 15 |
52 | | - describe file("#{apache_hash['mod_dir']}/php7.conf") do |
53 | | - it { is_expected.to contain 'DirectoryIndex index.php' } |
54 | | - end |
55 | | - else |
56 | | - describe file("#{apache_hash['mod_dir']}/php5.conf") do |
57 | | - 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 |
58 | 65 | end |
59 | 66 | end |
60 | | - end |
61 | 67 |
|
62 | | - context 'custom extensions, php_flag, php_value, php_admin_flag, and php_admin_value' do |
63 | | - pp = <<-MANIFEST |
64 | | - class { 'apache': |
65 | | - 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'], |
66 | 75 | } |
67 | | - class { 'apache::mod::php': |
68 | | - extensions => ['.php','.php5'], |
69 | | - } |
70 | 76 |
|
71 | | - apache::vhost { 'php.example.com': |
72 | | - port => '80', |
73 | | - docroot => '#{apache_hash['doc_root']}/php', |
74 | | - php_values => { 'include_path' => '.:/usr/share/pear:/usr/bin/php', }, |
75 | | - php_flags => { 'display_errors' => 'on', }, |
76 | | - php_admin_values => { 'open_basedir' => '/var/www/php/:/usr/share/pear/', }, |
77 | | - php_admin_flags => { 'engine' => 'on', }, |
78 | | - } |
79 | | - host { 'php.example.com': ip => '127.0.0.1', } |
80 | | - file { '#{apache_hash['doc_root']}/php/index.php5': |
81 | | - ensure => file, |
82 | | - content => "<?php phpinfo(); ?>\\n", |
83 | | - } |
84 | | - MANIFEST |
85 | | - it 'succeeds in puppeting php' do |
86 | | - apply_manifest(pp, catch_failures: true) |
87 | | - 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 |
88 | 94 |
|
89 | | - describe file("#{apache_hash['vhost_dir']}/25-php.example.com.conf") do |
90 | | - it { is_expected.to contain ' php_flag display_errors on' } |
91 | | - it { is_expected.to contain ' php_value include_path ".:/usr/share/pear:/usr/bin/php"' } |
92 | | - it { is_expected.to contain ' php_admin_flag engine on' } |
93 | | - 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 |
94 | 101 | end |
95 | 102 | end |
96 | 103 | end |
0 commit comments