Bug 9978: Replace license header with the correct license (GPLv3+)
[koha_ffzg] / xt / permissions.t
index 7e61524..a39b1ee 100755 (executable)
@@ -4,18 +4,18 @@
 #
 # 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 2 of the License, or (at your option) any later
-# version.
+# 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.
+# 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, write to the Free Software Foundation, Inc.,
-# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+# You should have received a copy of the GNU General Public License
+# along with Koha; if not, see <http://www.gnu.org/licenses>.
 
 use strict;
 use warnings;
@@ -24,13 +24,17 @@ use Test::More qw(no_plan);
 
 use C4::Context;
 
-my $root_dir = C4::Context->config( 'intranetdir' ) . '/installer/data/mysql';
+my $root_dir = 'installer/data/mysql';
 my $base_perms_file = "en/mandatory/userpermissions.sql";
 my @trans_perms_files = qw(
+    de-DE/mandatory/userpermissions.sql
+    it-IT/necessari/userpermissions.sql
     fr-FR/1-Obligatoire/userpermissions.sql
-    uk-UA/mandatory/userpermissions.sql
-    ru-RU/mandatory/userpermissions.sql
+    uk-UA/mandatory/permissions_and_user_flags.sql
+    ru-RU/mandatory/permissions_and_user_flags.sql
     pl-PL/mandatory/userpermissions.sql
+    nb-NO/1-Obligatorisk/userpermissions.sql
+    es-ES/mandatory/userpermissions.sql
 );
 
 ok(
@@ -58,8 +62,11 @@ foreach my $file_name ( @trans_perms_files ) {
 sub get_perms_from_file {
     my $fh = shift;
     my %perm;
+    my $found_insert = 0;
     while ( <$fh> ) {
         next if /^--/; # Comment line
+        $found_insert = 1 if /insert\s+into/i and /permissions/i;
+        next unless $found_insert;
         #/VALUES.*\(\'([\w\-:]+)\'/;
         /,\s*\'(.*?)\'/;
         my $variable = $1;