From b9a265e1b377900f030ee375bd135e47c30ea116 Mon Sep 17 00:00:00 2001 From: Galen Charlton Date: Mon, 12 May 2008 11:41:56 -0500 Subject: [PATCH] fixed installer test Now handles cases where two SQL scripts in different directories have the same name, e.g., fr-FR sample_itemtypes.sql. Bug was masked by existing failure when attempting to load both sample_itemtypes.sql. Signed-off-by: Joshua Ferraro --- t/lib/KohaTest/Installer/SqlScripts.pm | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/t/lib/KohaTest/Installer/SqlScripts.pm b/t/lib/KohaTest/Installer/SqlScripts.pm index 592bd3391c..510c574b21 100644 --- a/t/lib/KohaTest/Installer/SqlScripts.pm +++ b/t/lib/KohaTest/Installer/SqlScripts.pm @@ -51,14 +51,21 @@ sub installer_all_sample_data : Tests { my ($fwk_language, $installed_list) = $self->{installer}->load_sql_in_order($all_languages, @$list); # extract list of files - my @file_list = map { map { $_ } @{ $_->{fwklist} } } @$installed_list; + my $level; + my @file_list = map { + map { $_->{level} = $level; $_ } @{ $level = $_->{level}; $_->{fwklist} } + } @$installed_list; my $num_processed = scalar(@file_list); cmp_ok($num_processed, '==', $sql_count, "processed all sql scripts for $lang_code, $flavour"); - my %sql_to_load = map { my $file = $_; $file =~ s!^(.*)(/|\\)!!; $file => 1 } @$list; + my %sql_to_load = map { my $file = $_; + my @file = split qr(\/|\\), $file; + join("\t", $file[-2], $file[-1]) => 1 + } @$list; foreach my $sql (@file_list) { - ok(exists($sql_to_load{ $sql->{fwkname} }), "SQL script $sql->{fwkname} is on list"); - delete $sql_to_load{ $sql->{fwkname} }; + ok(exists($sql_to_load{ "$sql->{level}\t$sql->{fwkname}" }), + "SQL script $sql->{level}/$sql->{fwkname} is on list"); + delete $sql_to_load{ "$sql->{level}\t$sql->{fwkname}" }; is($sql->{error}, "", "no errors when loading $sql->{fwkname}"); } ok(not(%sql_to_load), "no SQL scripts for $lang_code, $flavour left unloaded"); -- 2.39.5