View | Details | Raw Unified | Return to bug 41167
Collapse All | Expand All

(-)a/xt/check_apache_conf.t (-1 / +48 lines)
Line 0 Link Here
0
- 
1
#!/usr/bin/perl
2
3
# This file is part of Koha.
4
#
5
# Koha is free software; you can redistribute it and/or modify it under the
6
# terms of the GNU General Public License as published by the Free Software
7
# Foundation; either version 3 of the License, or (at your option) any later
8
# version.
9
#
10
# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
11
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
12
# A PARTICULAR PURPOSE. See the GNU General Public License for more details.
13
#
14
# You should have received a copy of the GNU General Public License along
15
# with Koha; if not, see <https://www.gnu.org/licenses>.
16
17
use Modern::Perl;
18
19
use Test::More tests => 2;
20
21
use Test::NoWarnings;
22
23
use Array::Utils qw( array_minus );
24
use File::Slurp  qw(read_file);
25
26
subtest 'Intranet RewriteRule statements' => sub {
27
    plan tests => 1;
28
    my @debian_content = map { chomp; $_ } read_file('debian/templates/apache-shared-intranet.conf');
29
    my @httpd_content  = map { chomp; $_ } read_file('etc/koha-httpd.conf');
30
31
    my @debian_rewrite_rules =
32
        map { my $x = $_; $x =~ s/^\s+//; $x =~ m/RewriteRule|RewriteCond/ ? $x : () } @debian_content;
33
34
    my @httpd_intranet_rewrite_rules;
35
    my $pattern = "## Intranet";
36
    my $found   = 0;
37
    foreach my $line (@httpd_content) {
38
        if ( $found && $line !~ m/^#/ && $line =~ m/RewriteRule|RewriteCond/ ) {
39
            $line =~ s/^\s+//;
40
            push @httpd_intranet_rewrite_rules, $line;
41
        } elsif ( $line =~ m/$pattern/ ) {
42
            $found = 1;
43
        }
44
    }
45
    my @diff = array_minus @debian_rewrite_rules, @httpd_intranet_rewrite_rules;
46
    is( scalar(@diff), 0, "All RewriteRule and RewriteCond directives must be copied to etc/koha-httpd.conf" )
47
        or diag @diff;
48
};

Return to bug 41167