Bug 7298: (follow-up) fix uninitialized variable warning
[koha.git] / xt / permissions.t
index 5f782b9..64998ce 100755 (executable)
@@ -13,9 +13,9 @@
 # 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., 59 Temple Place,
-# Suite 330, Boston, MA  02111-1307 USA
+# 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.
 
 use strict;
 use warnings;
@@ -23,15 +23,18 @@ use warnings;
 use Test::More qw(no_plan);
 
 use C4::Context;
-use YAML;
 
-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(
@@ -59,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;