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

(-)a/t/00-checkdatabase-version.t (-61 lines)
Lines 1-60 Link Here
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
6
# under the terms of the GNU General Public License as published by
7
# the Free Software Foundation; either version 3 of the License, or
8
# (at your option) any later version.
9
#
10
# Koha is distributed in the hope that it will be useful, but
11
# WITHOUT ANY WARRANTY; without even the implied warranty of
12
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
# GNU General Public License for more details.
14
#
15
# You should have received a copy of the GNU General Public License
16
# along with Koha; if not, see <http://www.gnu.org/licenses>.
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
42
               if $file =~ /updatedatabase/
43
                  && (   /s\/XXX\$\/999\/;/
44
                      || /\$_\[0\]=~ \/XXX\$\/;/
45
                      || /version contains XXX/
46
                      || /\$proposed_version =~ m\/XXX\// );
47
           $xxx_found = 1;
48
          last;
49
       }
50
     }
51
     close $fh;
52
     if ($xxx_found) {
53
         fail("$file has no XXX in it");
54
        diag("XXX found in line $line");
55
     } else {
56
        pass("$file has no XXX in it");
57
    }
58
}
59
60
done_testing();
61
- 

Return to bug 32248