test suite: allow skipping of expensive tests
[koha.git] / t / icondirectories.t
1 #!/usr/bin/env perl
2
3 =head1 NAME
4
5 icondirectories.t - test to ensure that the two directories of icons
6 in the staff and opac interface are identical.
7
8 =head1 DESCRIPTION
9
10 Tere are two directories of icons for media types, one for the opac
11 and one for the staff interface. They need to be identical. This
12 ensures that they are.
13
14 =cut
15
16 use strict;
17 use warnings;
18
19 use lib qw( .. );
20
21 use C4::Koha;
22
23 use Data::Dumper;
24 use File::Find;
25 use Test::More tests => 1;
26
27 my $opac_icon_directory = getitemtypeimagedir();
28 my $staff_icon_directory = getitemtypeimagedir( 'intranet' );
29
30 my $opac_icons; # hashref of filenames to sizes
31 sub opac_wanted {
32     my $file = $File::Find::name;
33     $file =~ s/^$opac_icon_directory//;
34     $opac_icons->{ $file } = -s $_;
35 }
36
37 find( \&opac_wanted, $opac_icon_directory );
38
39 my $staff_icons; # hashref of filenames to sizes
40 sub staff_wanted {
41     my $file = $File::Find::name;
42     $file =~ s/^$staff_icon_directory//;
43     $staff_icons->{ $file } = -s $_;
44 }
45 find( \&staff_wanted, $staff_icon_directory );
46
47 is_deeply( $opac_icons, $staff_icons )
48   or diag( Data::Dumper->Dump( [ $opac_icons ], [ 'opac_icons' ] ) );
49
50
51
52
53
54
55
56
57
58
59
60
61
62