From 4a3fa0bdd84a0e8f380f97b27a3011588b08bded Mon Sep 17 00:00:00 2001 From: Kyle M Hall Date: Tue, 30 Jun 2015 08:25:29 -0400 Subject: [PATCH] Bug 9809 - Update unit tests --- t/db_dependent/Circulation.t | 5 +-- t/db_dependent/Holds.t | 6 ---- t/db_dependent/Holds/LocalHoldsPriority.t | 1 - t/db_dependent/Holds/RevertWaitingStatus.t | 1 - t/db_dependent/HoldsQueue.t | 3 +- t/db_dependent/Reserves.t | 35 +++++++++++++-------------- 6 files changed, 20 insertions(+), 31 deletions(-) diff --git a/t/db_dependent/Circulation.t b/t/db_dependent/Circulation.t index 30a5fe7..6d30e64 100755 --- a/t/db_dependent/Circulation.t +++ b/t/db_dependent/Circulation.t @@ -262,7 +262,6 @@ C4::Context->dbh->do("DELETE FROM accountlines"); my $renewing_borrower = GetMember( borrowernumber => $renewing_borrowernumber ); - my $constraint = 'a'; my $bibitems = ''; my $priority = '1'; my $resdate = undef; @@ -289,7 +288,7 @@ C4::Context->dbh->do("DELETE FROM accountlines"); # Biblio-level hold, renewal test AddReserve( $branch, $reserving_borrowernumber, $biblionumber, - $constraint, $bibitems, $priority, $resdate, $expdate, $notes, + $bibitems, $priority, $resdate, $expdate, $notes, $title, $checkitem, $found ); @@ -354,7 +353,7 @@ C4::Context->dbh->do("DELETE FROM accountlines"); # Item-level hold, renewal test AddReserve( $branch, $reserving_borrowernumber, $biblionumber, - $constraint, $bibitems, $priority, $resdate, $expdate, $notes, + $bibitems, $priority, $resdate, $expdate, $notes, $title, $itemnumber, $found ); diff --git a/t/db_dependent/Holds.t b/t/db_dependent/Holds.t index 5a480d8..033af1d 100755 --- a/t/db_dependent/Holds.t +++ b/t/db_dependent/Holds.t @@ -65,7 +65,6 @@ foreach my $borrowernumber ( @borrowernumbers ) { $branch, $borrowernumber, $biblionumber, - my $constraint = 'a', my $bibitems = q{}, my $priority, my $resdate, @@ -131,7 +130,6 @@ AddReserve( $branch, $borrowernumber, $biblionumber, - my $constraint = 'a', my $bibitems = q{}, my $priority, my $resdate, @@ -237,7 +235,6 @@ AddReserve( $branch, $borrowernumbers[0], $bibnum, - 'a', '', 1, ); @@ -254,7 +251,6 @@ AddReserve( $branch, $borrowernumbers[1], $bibnum, - 'a', '', 2, ); @@ -275,7 +271,6 @@ AddReserve( $branch, $borrowernumbers[0], $bibnum, - 'a', '', 2, ); @@ -308,7 +303,6 @@ AddReserve( $branch, $borrowernumbers[0], $bibnum, - 'a', '', 1, ); diff --git a/t/db_dependent/Holds/LocalHoldsPriority.t b/t/db_dependent/Holds/LocalHoldsPriority.t index 9f95854..8bbcdb4 100755 --- a/t/db_dependent/Holds/LocalHoldsPriority.t +++ b/t/db_dependent/Holds/LocalHoldsPriority.t @@ -58,7 +58,6 @@ foreach my $borrowernumber (@borrowernumbers) { $branchcodes[$i], $borrowernumber, $biblionumber, - my $constraint = 'a', my $bibitems = q{}, my $priority = $i, my $resdate, diff --git a/t/db_dependent/Holds/RevertWaitingStatus.t b/t/db_dependent/Holds/RevertWaitingStatus.t index 7b43edd..a7648fd 100755 --- a/t/db_dependent/Holds/RevertWaitingStatus.t +++ b/t/db_dependent/Holds/RevertWaitingStatus.t @@ -67,7 +67,6 @@ foreach my $borrowernumber (@borrowernumbers) { $branch, $borrowernumber, $biblionumber, - my $constraint = 'a', my $bibitems = q{}, my $priority, my $resdate, diff --git a/t/db_dependent/HoldsQueue.t b/t/db_dependent/HoldsQueue.t index 0a96143..6d997d6 100755 --- a/t/db_dependent/HoldsQueue.t +++ b/t/db_dependent/HoldsQueue.t @@ -95,11 +95,10 @@ foreach ( $borrower_branchcode, $least_cost_branch_code, @other_branches ) { # Remove existing reserves, makes debugging easier $dbh->do("DELETE FROM reserves"); -my $constraint = undef; my $bibitems = undef; my $priority = 1; # Make a reserve -AddReserve ( $borrower_branchcode, $borrowernumber, $biblionumber, $constraint, $bibitems, $priority ); +AddReserve ( $borrower_branchcode, $borrowernumber, $biblionumber, $bibitems, $priority ); # $resdate, $expdate, $notes, $title, $checkitem, $found $dbh->do("UPDATE reserves SET reservedate = DATE_SUB( reservedate, INTERVAL 1 DAY )"); diff --git a/t/db_dependent/Reserves.t b/t/db_dependent/Reserves.t index fa0cf94..0bc57c9 100755 --- a/t/db_dependent/Reserves.t +++ b/t/db_dependent/Reserves.t @@ -99,7 +99,6 @@ my $borrower = GetMember( borrowernumber => $borrowernumber ); my $biblionumber = $bibnum; my $barcode = $testbarcode; -my $constraint = 'a'; my $bibitems = ''; my $priority = '1'; my $resdate = undef; @@ -112,7 +111,7 @@ my @branches = GetBranchesLoop(); my $branch = $branches[0][0]{value}; AddReserve($branch, $borrowernumber, $biblionumber, - $constraint, $bibitems, $priority, $resdate, $expdate, $notes, + $bibitems, $priority, $resdate, $expdate, $notes, $title, $checkitem, $found); my ($status, $reserve, $all_reserves) = CheckReserves($itemnumber, $barcode); @@ -223,13 +222,13 @@ my ($itemnum_cpl, $itemnum_fpl); # (bug 11947) $dbh->do("DELETE FROM reserves WHERE biblionumber=?",undef,($bibnum2)); AddReserve('RPL', $requesters{'RPL'}, $bibnum2, - $constraint, $bibitems, 1, $resdate, $expdate, $notes, + $bibitems, 1, $resdate, $expdate, $notes, $title, $checkitem, $found); AddReserve('FPL', $requesters{'FPL'}, $bibnum2, - $constraint, $bibitems, 2, $resdate, $expdate, $notes, + $bibitems, 2, $resdate, $expdate, $notes, $title, $checkitem, $found); AddReserve('CPL', $requesters{'CPL'}, $bibnum2, - $constraint, $bibitems, 3, $resdate, $expdate, $notes, + $bibitems, 3, $resdate, $expdate, $notes, $title, $checkitem, $found); ModReserveAffect($itemnum_cpl, $requesters{'RPL'}, 0); @@ -244,13 +243,13 @@ is($reserves[2]{priority}, 2, 'Item is correctly priority 2'); $dbh->do("DELETE FROM reserves WHERE biblionumber=?",undef,($bibnum2)); AddReserve('RPL', $requesters{'RPL'}, $bibnum2, - $constraint, $bibitems, 1, $resdate, $expdate, $notes, + $bibitems, 1, $resdate, $expdate, $notes, $title, $checkitem, $found); AddReserve('FPL', $requesters{'FPL'}, $bibnum2, - $constraint, $bibitems, 2, $resdate, $expdate, $notes, + $bibitems, 2, $resdate, $expdate, $notes, $title, $checkitem, $found); AddReserve('CPL', $requesters{'CPL'}, $bibnum2, - $constraint, $bibitems, 3, $resdate, $expdate, $notes, + $bibitems, 3, $resdate, $expdate, $notes, $title, $checkitem, $found); # Ensure that the item's home library controls hold policy lookup @@ -300,7 +299,7 @@ $resdate= undef; #defaults to today in AddReserve $expdate= undef; #no expdate $dbh->do("DELETE FROM reserves WHERE biblionumber=?",undef,($bibnum)); AddReserve('CPL', $requesters{'CPL'}, $bibnum, - $constraint, $bibitems, 1, $resdate, $expdate, $notes, + $bibitems, 1, $resdate, $expdate, $notes, $title, $checkitem, $found); ($status)=CheckReserves($itemnumber,undef,undef); is( $status, 'Reserved', 'CheckReserves returns reserve without lookahead'); @@ -315,7 +314,7 @@ $resdate->add_duration(DateTime::Duration->new(days => 4)); $resdate=output_pref($resdate); $expdate= undef; #no expdate AddReserve('CPL', $requesters{'CPL'}, $bibnum, - $constraint, $bibitems, 1, $resdate, $expdate, $notes, + $bibitems, 1, $resdate, $expdate, $notes, $title, $checkitem, $found); ($status)=CheckReserves($itemnumber,undef,undef); is( $status, '', 'CheckReserves returns no future reserve without lookahead'); @@ -372,14 +371,14 @@ $resdate= dt_from_string(); $resdate->add_duration(DateTime::Duration->new(days => 2)); $resdate=output_pref($resdate); AddReserve('CPL', $requesters{'CPL'}, $bibnum, - $constraint, $bibitems, 1, $resdate, $expdate, $notes, + $bibitems, 1, $resdate, $expdate, $notes, $title, $checkitem, $found); my @results= GetReservesFromItemnumber($itemnumber); is(defined $results[3]?1:0, 0, 'GetReservesFromItemnumber does not return a future next available hold'); # 9788b: GetReservesFromItemnumber does not return future item level hold $dbh->do("DELETE FROM reserves WHERE biblionumber=?",undef,($bibnum)); AddReserve('CPL', $requesters{'CPL'}, $bibnum, - $constraint, $bibitems, 1, $resdate, $expdate, $notes, + $bibitems, 1, $resdate, $expdate, $notes, $title, $itemnumber, $found); #item level hold @results= GetReservesFromItemnumber($itemnumber); is(defined $results[3]?1:0, 0, 'GetReservesFromItemnumber does not return a future item level hold'); @@ -394,7 +393,7 @@ my $p = C4::Reserves::CalculatePriority($bibnum2); is($p, 4, 'CalculatePriority should now return priority 4'); $resdate=undef; AddReserve('CPL', $requesters{'CPL'}, $bibnum2, - $constraint, $bibitems, $p, $resdate, $expdate, $notes, + $bibitems, $p, $resdate, $expdate, $notes, $title, $checkitem, $found); $p = C4::Reserves::CalculatePriority($bibnum2); is($p, 5, 'CalculatePriority should now return priority 5'); @@ -404,7 +403,7 @@ $p = C4::Reserves::CalculatePriority($bibnum); is($p, 1, 'CalculatePriority should now return priority 1'); #add a new reserve and confirm it to waiting AddReserve('CPL', $requesters{'CPL'}, $bibnum, - $constraint, $bibitems, $p, $resdate, $expdate, $notes, + $bibitems, $p, $resdate, $expdate, $notes, $title, $itemnumber, $found); $p = C4::Reserves::CalculatePriority($bibnum); is($p, 2, 'CalculatePriority should now return priority 2'); @@ -413,7 +412,7 @@ $p = C4::Reserves::CalculatePriority($bibnum); is($p, 1, 'CalculatePriority should now return priority 1'); #add another biblio hold, no resdate AddReserve('CPL', $requesters{'CPL'}, $bibnum, - $constraint, $bibitems, $p, $resdate, $expdate, $notes, + $bibitems, $p, $resdate, $expdate, $notes, $title, $checkitem, $found); $p = C4::Reserves::CalculatePriority($bibnum); is($p, 2, 'CalculatePriority should now return priority 2'); @@ -422,7 +421,7 @@ C4::Context->set_preference('AllowHoldDateInFuture', 1); $resdate= dt_from_string(); $resdate->add_duration(DateTime::Duration->new(days => 1)); AddReserve('CPL', $requesters{'CPL'}, $bibnum, - $constraint, $bibitems, $p, output_pref($resdate), $expdate, $notes, + $bibitems, $p, output_pref($resdate), $expdate, $notes, $title, $checkitem, $found); $p = C4::Reserves::CalculatePriority($bibnum); is($p, 2, 'CalculatePriority should now still return priority 2'); @@ -434,7 +433,7 @@ is($p, 3, 'CalculatePriority should now return priority 3'); # Tests for cancel reserves by users from OPAC. $dbh->do('DELETE FROM reserves', undef, ($bibnum)); AddReserve('CPL', $requesters{'CPL'}, $item_bibnum, - $constraint, $bibitems, 1, undef, $expdate, $notes, + $bibitems, 1, undef, $expdate, $notes, $title, $checkitem, ''); my (undef, $canres, undef) = CheckReserves($itemnumber); @@ -464,7 +463,7 @@ is($cancancel, 0, 'Reserve in transfer status cant be canceled'); $dbh->do('DELETE FROM reserves', undef, ($bibnum)); AddReserve('CPL', $requesters{'CPL'}, $item_bibnum, - $constraint, $bibitems, 1, undef, $expdate, $notes, + $bibitems, 1, undef, $expdate, $notes, $title, $checkitem, ''); (undef, $canres, undef) = CheckReserves($itemnumber); -- 1.7.2.5