Bug 21846: Simplify ugly double for loops
authorJonathan Druart <jonathan.druart@bugs.koha-community.org>
Tue, 26 Feb 2019 20:01:41 +0000 (17:01 -0300)
committerNick Clemens <nick@bywatersolutions.com>
Fri, 15 Mar 2019 12:27:44 +0000 (12:27 +0000)
Signed-off-by: Josef Moravec <josef.moravec@gmail.com>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>

t/db_dependent/Tags.t

index 0952e9a..93014bb 100755 (executable)
@@ -89,8 +89,8 @@ subtest 'add_tag_index() tests' => sub {
         '👍'  => 1,
     };
 
-    for my $term ( keys %{ $terms } ) {
-        for (my $i=1; $i <= $terms->{$term}; $i++) {
+    while ( my ( $term, $count ) = each %$terms ) {
+        for  ( 1 .. $count ) {
             C4::Tags::add_tag_approval( $term );
             C4::Tags::add_tag_index( $term, $biblio->biblionumber );
         }