From 4fc4b8ce8794ad670d07812a7cfa9b0b99df3ba3 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 Content-Type: text/plain; charset=utf-8 Signed-off-by: Marcel de Rooy --- 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 01e67db..b41e144 100755 --- a/t/db_dependent/Holds.t +++ b/t/db_dependent/Holds.t @@ -68,7 +68,6 @@ foreach my $borrowernumber ( @borrowernumbers ) { $branch, $borrowernumber, $biblionumber, - my $constraint = 'a', my $bibitems = q{}, my $priority, my $resdate, @@ -148,7 +147,6 @@ AddReserve( $branch, $borrowernumber, $biblionumber, - my $constraint = 'a', my $bibitems = q{}, my $priority, my $resdate, @@ -254,7 +252,6 @@ AddReserve( $branch, $borrowernumbers[0], $bibnum, - 'a', '', 1, ); @@ -271,7 +268,6 @@ AddReserve( $branch, $borrowernumbers[1], $bibnum, - 'a', '', 2, ); @@ -292,7 +288,6 @@ AddReserve( $branch, $borrowernumbers[0], $bibnum, - 'a', '', 2, ); @@ -325,7 +320,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 340b7bf..61be6d0 100755 --- a/t/db_dependent/Reserves.t +++ b/t/db_dependent/Reserves.t @@ -100,7 +100,6 @@ my $borrower = GetMember( borrowernumber => $borrowernumber ); my $biblionumber = $bibnum; my $barcode = $testbarcode; -my $constraint = 'a'; my $bibitems = ''; my $priority = '1'; my $resdate = undef; @@ -113,7 +112,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); @@ -224,13 +223,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); @@ -249,13 +248,13 @@ is( $reserves[0]->borrowernumber(), $requesters{'RPL'}, 'GetWaiting got the rese $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 @@ -305,7 +304,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'); @@ -320,7 +319,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'); @@ -377,14 +376,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'); @@ -399,7 +398,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'); @@ -409,7 +408,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'); @@ -418,7 +417,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'); @@ -427,7 +426,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'); @@ -439,7 +438,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); @@ -469,7 +468,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.10.4