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

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

Return to bug 41167