From 5fb905fac72a59fb06a72717874c749f76480fde Mon Sep 17 00:00:00 2001 From: Kyle M Hall Date: Mon, 15 Sep 2014 08:06:44 -0400 Subject: [PATCH] Bug 12892 - Unit Tests --- t/db_dependent/Reserves.t | 10 +++++++++- 1 files changed, 9 insertions(+), 1 deletions(-) diff --git a/t/db_dependent/Reserves.t b/t/db_dependent/Reserves.t index 0698534..66ea37f 100755 --- a/t/db_dependent/Reserves.t +++ b/t/db_dependent/Reserves.t @@ -2,7 +2,7 @@ use Modern::Perl; -use Test::More tests => 35; +use Test::More tests => 38; use MARC::Record; use DateTime::Duration; @@ -12,6 +12,8 @@ use C4::Biblio; use C4::Items; use C4::Members; use C4::Circulation; +use Koha::Database; + use t::lib::Mocks; use Koha::DateUtils; @@ -225,6 +227,12 @@ is($reserves[0]{priority}, 0, 'Item is correctly waiting'); is($reserves[1]{priority}, 1, 'Item is correctly priority 1'); is($reserves[2]{priority}, 2, 'Item is correctly priority 2'); +my $reserve_rs = Koha::Database->new()->schema()->resultset('Reserve'); +my $waiting = $reserve_rs->GetWaiting({ borrowernumber => $requesters{'RPL'} }); +ok( $waiting->count() == 1, 'GetWaiting got only the waiting reserve' ); +my $w = $waiting->first(); +ok( $w->found() eq 'W', 'GetWaiting got the waiting reserve'); +ok( $w->get_column('borrowernumber') eq $requesters{'RPL'}, 'GetWaiting got the reserve for the correct borrower' ); $dbh->do("DELETE FROM reserves WHERE biblionumber=?",undef,($bibnum2)); AddReserve('RPL', $requesters{'RPL'}, $bibnum2, -- 1.7.2.5