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

(-)a/t/00-checkdatabase-version.t (-1 / +55 lines)
Line 0 Link Here
0
- 
1
# Copyright 2010 Chris Cormack
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 2 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, write to the Free Software Foundation, Inc.,
16
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17
18
use strict;
19
use warnings;
20
21
use Test::More;
22
use File::Spec;
23
use File::Find;
24
use IO::File;
25
26
my @files =('kohaversion.pl','installer/data/mysql/updatedatabase.pl');
27
28
foreach my $file (@files){
29
    next unless -f $file;
30
    my @name_parts = File::Spec->splitpath($file);
31
    my %dirs = map { $_ => 1 } File::Spec->splitdir($name_parts[1]);
32
    next if exists $dirs{'.git'};
33
34
    my $fh = IO::File->new($file, 'r');
35
    my $xxx_found = 0;
36
    my $line = 0;
37
    while (<$fh>) {
38
       $line++;
39
       if (/XXX/i) {
40
           #two lines are an exception for updatedatabase (routine SetVersion and TransferToNum)
41
           next if $file=~ /updatedatabase/ && ( /s\/XXX\$\/999\/;/ || /\$_\[0\]=~ \/XXX\$\/;/ );
42
           $xxx_found = 1;
43
          last;
44
       }
45
     }
46
     close $fh;
47
     if ($xxx_found) {
48
         fail("$file has no XXX in it");
49
        diag("XXX found in line $line");
50
     } else {
51
        pass("$file has no XXX in it");
52
    }
53
}
54
55
done_testing();

Return to bug 6700