From 3387a6114b70cf8de021c4cdf84a687e629efc82 Mon Sep 17 00:00:00 2001 From: Mark Tompsett Date: Sat, 23 May 2015 00:22:26 -0400 Subject: [PATCH] Bug 14097 - Correct noise under Debian The first four patches do not create any noise under Ubuntu 14.04 LTS. Running on Debian Jessie: [SNIP] keys on reference is experimental at t/db_dependent/UsageStats.t line 88. keys on reference is experimental at t/db_dependent/UsageStats.t line 106. keys on reference is experimental at t/db_dependent/UsageStats.t line 119. keys on reference is experimental at t/db_dependent/UsageStats.t line 136. keys on reference is experimental at t/db_dependent/UsageStats.t line 153. keys on reference is experimental at t/db_dependent/UsageStats.t line 162. keys on reference is experimental at t/db_dependent/UsageStats.t line 587. [SNIP] Instead of having 'keys $foo->{bar}', 'keys %{$foo->{bar}}' was used. TEST PLAN --------- 1) On a DEBIAN system (Jessie gives above messages) apply the first 4 patches interactively. 2) $ prove t/db_dependent/UsageStats.t -- trigger noise like above. 3) apply this patch 4) $ prove t/db_dependent/UsageStats.t -- no noise triggered. 5) koha qa test tools Signed-off-by: Indranil Das Gupta (L2C2 Technologies) Signed-off-by: Jonathan Druart Signed-off-by: Brendan Gallagher brendan@bywatersolutions.com --- t/db_dependent/UsageStats.t | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/t/db_dependent/UsageStats.t b/t/db_dependent/UsageStats.t index b98f05bd88..ad2dd1560a 100644 --- a/t/db_dependent/UsageStats.t +++ b/t/db_dependent/UsageStats.t @@ -85,7 +85,7 @@ my $report = C4::UsageStats->BuildReport(); isa_ok( $report, 'HASH', '$report is a HASH' ); isa_ok( $report->{library}, 'HASH', '$report->{library} is a HASH' ); -is( scalar( keys( $report->{library} ) ), 5, "There are 5 fields in $report->{library}" ); +is( scalar( keys %{$report->{library}} ), 5, "There are 5 fields in $report->{library}" ); is( $report->{library}->{id}, 0, "UsageStatsID is good" ); is( $report->{library}->{name}, '', "UsageStatsLibraryName is good" ); is( $report->{library}->{url}, '', "UsageStatsLibraryUrl is good" ); @@ -103,7 +103,7 @@ $report = C4::UsageStats->BuildReport(); isa_ok( $report, 'HASH', '$report is a HASH' ); isa_ok( $report->{library}, 'HASH', '$report->{library} is a HASH' ); -is( scalar( keys( $report->{library} ) ), 5, "There are 5 fields in $report->{library}" ); +is( scalar( keys %{$report->{library}} ), 5, "There are 5 fields in $report->{library}" ); is( $report->{library}->{id}, 1, "UsageStatsID is good" ); is( $report->{library}->{name}, 'NAME', "UsageStatsLibraryName is good" ); is( $report->{library}->{url}, 'URL', "UsageStatsLibraryUrl is good" ); @@ -116,7 +116,7 @@ $report = C4::UsageStats->BuildReport(); isa_ok( $report, 'HASH', '$report is a HASH' ); isa_ok( $report->{volumetry}, 'HASH', '$report->{volumetry} is a HASH' ); -is( scalar( keys( $report->{volumetry} ) ), 8, "There are 8 fields in $report->{volumetry}" ); +is( scalar( keys %{$report->{volumetry}} ), 8, "There are 8 fields in $report->{volumetry}" ); is( $report->{volumetry}->{biblio}, 0, "There is no biblio" ); is( $report->{volumetry}->{items}, 0, "There is no items" ); is( $report->{volumetry}->{auth_header}, 0, "There is no auth_header" ); @@ -133,7 +133,7 @@ $report = C4::UsageStats->BuildReport(); isa_ok( $report, 'HASH', '$report is a HASH' ); isa_ok( $report->{volumetry}, 'HASH', '$report->{volumetry} is a HASH' ); -is( scalar( keys( $report->{volumetry} ) ), 8, "There are 8 fields in $report->{volumetry}" ); +is( scalar( keys %{$report->{volumetry}} ), 8, "There are 8 fields in $report->{volumetry}" ); is( $report->{volumetry}->{biblio}, 3, "There are 3 biblio" ); is( $report->{volumetry}->{items}, 3, "There are 3 items" ); is( $report->{volumetry}->{auth_header}, 2, "There are 2 auth_header" ); @@ -150,7 +150,7 @@ mocking_systempreferences_to_a_set_value(0); $report = C4::UsageStats->BuildReport(); isa_ok( $report, 'HASH', '$report is a HASH' ); isa_ok( $report->{systempreferences}, 'HASH', '$report->{systempreferences} is a HASH' ); -is( scalar( keys( $report->{systempreferences} ) ), 248, "There are 248 fields in $report->{systempreferences}" ); +is( scalar( keys %{$report->{systempreferences}} ), 248, "There are 248 fields in $report->{systempreferences}" ); verif_systempreferences_values( $report, 0 ); #mock with values @@ -159,7 +159,7 @@ mocking_systempreferences_to_a_set_value(1); $report = C4::UsageStats->BuildReport(); isa_ok( $report, 'HASH', '$report is a HASH' ); isa_ok( $report->{systempreferences}, 'HASH', '$report->{systempreferences} is a HASH' ); -is( scalar( keys( $report->{systempreferences} ) ), 248, "There are 248 fields in $report->{systempreferences}" ); +is( scalar( keys %{$report->{systempreferences}} ), 248, "There are 248 fields in $report->{systempreferences}" ); verif_systempreferences_values( $report, 1 ); # ---------- Testing ReportToCommunity ---------- @@ -584,7 +584,7 @@ sub mocking_systempreferences_to_a_set_value { sub verif_systempreferences_values { my ( $report, $value_to_test ) = @_; - foreach my $key ( keys $report->{systempreferences} ) { + foreach my $key ( keys %{$report->{systempreferences}} ) { is( $report->{systempreferences}->{$key}, $value_to_test, "\$report->{systempreferences}->{$key} = $value_to_test" ); } } -- 2.39.5