From 2b2457329467e5a30a748903eb60390f1cafd51d Mon Sep 17 00:00:00 2001 From: Marcel de Rooy Date: Mon, 3 Jun 2013 14:25:43 +0200 Subject: [PATCH] Bug 10290: Followup for Virtualshelves.t Put the 10 biblionumbers in a list Add a FIXME for deleting shelves Do temporary repair on duplicate name test (Followup via report 10386) Signed-off-by: Marcel de Rooy Signed-off-by: Galen Charlton (cherry picked from commit 1ef99ace2043d75889830c4c0af8af3e9e36104e) Signed-off-by: Tomas Cohen Arazi (cherry picked from commit e26655fe03c2f5181d6a820f40e38a7cebb46e05) Signed-off-by: Bernardo Gonzalez Kriegel Missed this one from previous release (cherry picked from commit e26655fe03c2f5181d6a820f40e38a7cebb46e05) --- t/db_dependent/VirtualShelves.t | 52 ++++++++++++++------------------- 1 file changed, 22 insertions(+), 30 deletions(-) diff --git a/t/db_dependent/VirtualShelves.t b/t/db_dependent/VirtualShelves.t index f73235b82a..323cc2c1c0 100755 --- a/t/db_dependent/VirtualShelves.t +++ b/t/db_dependent/VirtualShelves.t @@ -27,22 +27,14 @@ while(my $borrower = $sth->fetchrow){ } # Creating some biblios -my ($biblionumber1, $biblioitemnumber1) = AddBiblio(MARC::Record->new, ''); -my ($biblionumber2, $biblioitemnumber2) = AddBiblio(MARC::Record->new, ''); -my ($biblionumber3, $biblioitemnumber3) = AddBiblio(MARC::Record->new, ''); -my ($biblionumber4, $biblioitemnumber4) = AddBiblio(MARC::Record->new, ''); -my ($biblionumber5, $biblioitemnumber5) = AddBiblio(MARC::Record->new, ''); -my ($biblionumber6, $biblioitemnumber6) = AddBiblio(MARC::Record->new, ''); -my ($biblionumber7, $biblioitemnumber7) = AddBiblio(MARC::Record->new, ''); -my ($biblionumber8, $biblioitemnumber8) = AddBiblio(MARC::Record->new, ''); -my ($biblionumber9, $biblioitemnumber9) = AddBiblio(MARC::Record->new, ''); -my ($biblionumber10, $biblioitemnumber10) = AddBiblio(MARC::Record->new, ''); -my @biblionumbers = ( - $biblionumber1, $biblionumber2, $biblionumber3, $biblionumber4, $biblionumber5, - $biblionumber6, $biblionumber7, $biblionumber8, $biblionumber9, $biblionumber10, -); +my @biblionumbers; +foreach(0..9) { + my ($biblionumber)= AddBiblio(MARC::Record->new, ''); + #item number ignored + push @biblionumbers, $biblionumber; +} -# --- +# FIXME Why are you deleting my shelves? See bug 10386. my $delete_virtualshelf = q{ DELETE FROM virtualshelves WHERE 1 }; @@ -82,9 +74,19 @@ ok(10 == scalar @shelves, 'created 10 lists'); # 10 shelves in @shelves; # try to create some shelf which already exists. for(my $i=0;$i<10;$i++){ my @shlf=GetShelf($shelves[$i]); - my $badNumShelf = AddShelf( - {shelfname=>"Shelf_".$i, category=>$shlf[3] }, $borrowers[$i]); - ok(-1 == $badNumShelf, 'do not create lists with duplicate names'); # AddShelf returns -1 if name already exist. + + # FIXME This test still needs some attention + # A shelf name is not per se unique ! See report 10386 + #temporary hack: Original test only for public list + if( $shlf[3]==2 ) { + my $badNumShelf= AddShelf( + {shelfname=>"Shelf_".$i, category => 2}, $borrowers[$i]); + ok(-1==$badNumShelf, 'do not create public lists with duplicate names'); + #AddShelf returns -1 if name already exist. + } + else { + ok(1==1, "This trivial test cannot fail :)"); #leave count intact + } } #-----------TEST AddToShelf & GetShelfContents & DelFromShelf functions--------------# @@ -147,15 +149,5 @@ for(my $i=0; $i<10;$i++){ ok(1 == $status, "deleted shelf $shelfnumber and its contents"); } -END { - DelBiblio( $biblionumber1 ); - DelBiblio( $biblionumber2 ); - DelBiblio( $biblionumber3 ); - DelBiblio( $biblionumber4 ); - DelBiblio( $biblionumber5 ); - DelBiblio( $biblionumber6 ); - DelBiblio( $biblionumber7 ); - DelBiblio( $biblionumber8 ); - DelBiblio( $biblionumber9 ); - DelBiblio( $biblionumber10 ); -}; +#----------------------- CLEANUP ----------------------------------------------# +DelBiblio($_) for @biblionumbers; -- 2.39.5