From 295e39eb74196cbf1362114cac0ea712457641c9 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Wed, 21 Aug 2013 14:38:34 +0200 Subject: [PATCH] Bug 7677: UT: add unit tests for GetPreviousSerialid --- t/db_dependent/Serials_2.t | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/t/db_dependent/Serials_2.t b/t/db_dependent/Serials_2.t index 3d921b8..49670bf 100644 --- a/t/db_dependent/Serials_2.t +++ b/t/db_dependent/Serials_2.t @@ -75,4 +75,14 @@ my $userenv = C4::Context->userenv; is( C4::Serials::can_edit_subscription($subscription), 1, "User can edit a subscription with an empty branchcode"); #TODO add UT when C4::Auth->set_permissions (or setuserflags) will exist. +# GetPreviousSerialid +my $serialid1 = NewIssue( 1, $subscriptionid, $biblionumber, 2 ); +my $serialid2 = NewIssue( 2, $subscriptionid, $biblionumber, 2 ); +my $serialid3 = NewIssue( 3, $subscriptionid, $biblionumber, 2 ); + +is( GetPreviousSerialid( $subscriptionid ), $serialid2, "get previous serialid without parameter"); +is( GetPreviousSerialid( $subscriptionid, 1 ), $serialid2, "get previous serialid with 1" ); +is( GetPreviousSerialid( $subscriptionid, 2 ), $serialid1, "get previous serialid with 2" ); +is( GetPreviousSerialid( $subscriptionid, 3 ), undef, "get previous serialid with 3, does not exist" ); + $dbh->rollback; -- 1.7.10.4