[Koha-patches] [PATCH] More fixes to the shelves test

Chris Cormack chris at bigballofwax.co.nz
Mon Sep 14 10:23:17 CEST 2009


---
 t/db_dependent/VirtualShelves.t |   20 ++++++++++----------
 1 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/t/db_dependent/VirtualShelves.t b/t/db_dependent/VirtualShelves.t
index 49a4cdc..75f366b 100755
--- a/t/db_dependent/VirtualShelves.t
+++ b/t/db_dependent/VirtualShelves.t
@@ -10,7 +10,7 @@ use strict;
 use C4::Context;
 
 # Making 30 tests.
-BEGIN { plan tests => 32 }
+BEGIN { plan tests => 112 }
 
 # Getting some borrowers from database.
 my $dbh = C4::Context->dbh;
@@ -128,17 +128,17 @@ for(my $i=0; $i<10;$i++){
 for(my $i=0; $i<10;$i++){
     my $rand = int(rand(9));
     my $numA = $shelves[$rand];
-    my $nameA = "NewName_".$rand;
-    my $ownerA = $borrowers[$rand];
-    my $categoryA = int(rand(3))+1;
+    my $shelf = { shelfname => "NewName_".$rand,
+	owner => $borrowers[$rand],
+	category =>  int(rand(3))+1 };
     
-    ModShelf($numA,$nameA,$ownerA,$categoryA);
+    ModShelf($numA,$shelf);
     my ($numB,$nameB,$ownerB,$categoryB) = GetShelf($numA);
     
     ok($numA,$numB);
-    ok($nameA,$nameB);
-    ok($ownerB,$ownerA);
-    ok($categoryA,$categoryB);
+    ok($shelf->{shelfname},$nameB);
+    ok($shelf->{owner},$ownerB);
+    ok($shelf->{category},$categoryB);
 }
 
 #-----------------------TEST DelShelf & DelFromShelf functions------------------------#
@@ -149,8 +149,8 @@ for(my $i=0; $i<10;$i++){
     my $shelfnumber = $shelves[$i];
     my $status = DelShelf($shelfnumber);
     if($status){
-        my $items = GetShelfContents($shelfnumber);
-        ok($status,scalar @$items);
+        my ($items,$count) = GetShelfContents($shelfnumber);
+        ok($status,$count);
         foreach (@$items){ # delete all the item in this shelf
             DelFromShelf($_{'itemnumber'},$shelfnumber);
         }
-- 
1.6.0.4




More information about the Koha-patches mailing list