diff --git a/xt/find-missing-main-container.t b/xt/find-missing-main-container.t new file mode 100644 index 0000000000..4e485b0a39 --- /dev/null +++ b/xt/find-missing-main-container.t @@ -0,0 +1,53 @@ +#!/usr/bin/perl + +# This file is part of Koha. +# +# Koha is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# Koha is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Koha; if not, see . + +use Modern::Perl; +use File::Slurp qw( read_file ); +use Test::More; +use Array::Utils qw( array_minus ); + +use Test::NoWarnings; + +use Koha::Devel::Files; + +my $dev_files = Koha::Devel::Files->new( { context => 'core' } ); +my @tt_files = $dev_files->ls_tt_files; + +# Only for staff +@tt_files = grep {m{/intranet-tmpl/}} @tt_files; + +my @exceptions = qw( + koha-tmpl/intranet-tmpl/prog/en/includes/main-container.inc + koha-tmpl/intranet-tmpl/prog/en/includes/wrapper-staff-tool-plugin.inc +); + +@tt_files = array_minus( @tt_files, @exceptions ); + +plan tests => scalar(@tt_files) + 1; + +for my $file (@tt_files) { + + my @lines = read_file($file); + my ( $has_main, $has_main_container_fluid ); + for my $line (@lines) { + #$has_main_container_fluid = 1 if $line =~ m{
}; + $has_main = 1 if $line =~ m{
}; + } + + ok( !$has_main, qq{$file has '
', it must use main-container.inc instead.} ); + #is( $has_main_container_fluid, 0, qq{$file has '
', it must use main-container.inc instead.} ); +}