From 659ac6a904dbfe9c5e535963a4717fd183ffb7e6 Mon Sep 17 00:00:00 2001 From: Galen Charlton Date: Sat, 14 Dec 2013 00:24:06 +0000 Subject: [PATCH] Bug 10852: (follow-up) regression tests This patch adds regression tests for the changes to C4::Serials::SearchSubscriptions(). Signed-off-by: Galen Charlton --- t/db_dependent/Bookseller.t | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/t/db_dependent/Bookseller.t b/t/db_dependent/Bookseller.t index 2dc79e38f8..133ffb575c 100644 --- a/t/db_dependent/Bookseller.t +++ b/t/db_dependent/Bookseller.t @@ -2,7 +2,7 @@ use Modern::Perl; -use Test::More tests => 64; +use Test::More tests => 69; use C4::Context; use Koha::DateUtils; use DateTime::Duration; @@ -196,8 +196,8 @@ my $id_subscription1 = NewSubscription( '01-01-2013',undef, undef, undef, undef, undef, undef, undef, undef, undef, undef, 1, "subscription notes",undef, '01-01-2013', undef, undef, - undef, undef, 0, "intnotes", 0, - undef, undef, 0, undef, '31-12-2013', 0 + undef, 'CALL ABC', 0, "intnotes", 0, + undef, undef, 0, undef, '2013-11-30', 0 ); my @subscriptions = SearchSubscriptions({biblionumber => $biblionumber}); @@ -208,8 +208,8 @@ my $id_subscription2 = NewSubscription( '01-01-2013',undef, undef, undef, undef, undef, undef, undef, undef, undef, undef, 1, "subscription notes",undef, '01-01-2013', undef, undef, - undef, undef, 0, "intnotes", 0, - undef, undef, 0, undef, '31-12-2013', 0 + undef, 'CALL DEF', 0, "intnotes", 0, + undef, undef, 0, undef, '2013-07-31', 0 ); $bookseller1fromid = C4::Bookseller::GetBookSellerFromId($id_supplier1); @@ -367,9 +367,20 @@ my $id_subscription3 = NewSubscription( undef, undef, undef, undef, undef, undef, 1, "subscription notes",undef, '01-01-2013', undef, undef, undef, undef, 0, "intnotes", 0, - undef, undef, 0, undef, '31-12-2013', 0 + undef, undef, 0, 'LOCA', '2013-12-31', 0 ); +@subscriptions = SearchSubscriptions({expiration_date => '2013-12-31'}); +is(scalar(@subscriptions), 3, 'search for subscriptions by expiration date'); +@subscriptions = SearchSubscriptions({expiration_date => '2013-08-15'}); +is(scalar(@subscriptions), 1, 'search for subscriptions by expiration date'); +@subscriptions = SearchSubscriptions({callnumber => 'CALL'}); +is(scalar(@subscriptions), 2, 'search for subscriptions by call number'); +@subscriptions = SearchSubscriptions({callnumber => 'DEF'}); +is(scalar(@subscriptions), 1, 'search for subscriptions by call number'); +@subscriptions = SearchSubscriptions({location => 'LOCA'}); +is(scalar(@subscriptions), 1, 'search for subscriptions by location'); + #Add 4 orders my ( $ordernumber1, $ordernumber2, $ordernumber3, $ordernumber4 ); my ( $basketno1, $basketno2, $basketno3, $basketno4 ); -- 2.39.2