| | 152 | |
| | 153 | # Test that enable_page_deletion is set correctly in various circumstances. |
| | 154 | $config = Config::Tiny->new; |
| | 155 | $config->{_}->{template_path} = cwd . "/t/templates"; |
| | 156 | $config->{_}->{site_name} = "Test Site"; |
| | 157 | |
| | 158 | $output = OpenGuides::Template->output( |
| | 159 | wiki => $fake_wiki, |
| | 160 | config => $config, |
| | 161 | template => "15_test.tt", |
| | 162 | ); |
| | 163 | like( $output, qr/ENABLE PAGE DELETION: 0/, |
| | 164 | "enable_page_deletion var set correctly when not specified in conf" ); |
| | 165 | |
| | 166 | $config->{_}->{enable_page_deletion} = "n"; |
| | 167 | $output = OpenGuides::Template->output( |
| | 168 | wiki => $fake_wiki, |
| | 169 | config => $config, |
| | 170 | template => "15_test.tt", |
| | 171 | ); |
| | 172 | like( $output, qr/ENABLE PAGE DELETION: 0/, |
| | 173 | "enable_page_deletion var set correctly when set to 'n' in conf" ); |
| | 174 | |
| | 175 | $config->{_}->{enable_page_deletion} = "y"; |
| | 176 | $output = OpenGuides::Template->output( |
| | 177 | wiki => $fake_wiki, |
| | 178 | config => $config, |
| | 179 | template => "15_test.tt", |
| | 180 | ); |
| | 181 | like( $output, qr/ENABLE PAGE DELETION: 1/, |
| | 182 | "enable_page_deletion var set correctly when set to 'y' in conf" ); |
| | 183 | |
| | 184 | $config->{_}->{enable_page_deletion} = 0; |
| | 185 | $output = OpenGuides::Template->output( |
| | 186 | wiki => $fake_wiki, |
| | 187 | config => $config, |
| | 188 | template => "15_test.tt", |
| | 189 | ); |
| | 190 | like( $output, qr/ENABLE PAGE DELETION: 0/, |
| | 191 | "enable_page_deletion var set correctly when set to '0' in conf" ); |
| | 192 | |
| | 193 | $config->{_}->{enable_page_deletion} = 1; |
| | 194 | $output = OpenGuides::Template->output( |
| | 195 | wiki => $fake_wiki, |
| | 196 | config => $config, |
| | 197 | template => "15_test.tt", |
| | 198 | ); |
| | 199 | like( $output, qr/ENABLE PAGE DELETION: 1/, |
| | 200 | "enable_page_deletion var set correctly when set to '1' in conf" ); |