From b11c8722cb90909b94dd53c8dcf5cf390258ebb8 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 Signed-off-by: Brendan Gallagher http://bugs.koha-community.org/show_bug.cgi?id=7767 Signed-off-by: Katrin Fischer Signed-off-by: Kyle M Hall --- t/db_dependent/Serials_2.t | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/t/db_dependent/Serials_2.t b/t/db_dependent/Serials_2.t index a73ef1fdf5..52662b28f6 100644 --- a/t/db_dependent/Serials_2.t +++ b/t/db_dependent/Serials_2.t @@ -246,6 +246,18 @@ is( C4::Serials::can_show_subscription($subscription_from_another_branch), 1, $schema->storage->txn_rollback; +# 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; + # C4::Context->userenv sub Mock_userenv { return $userenv; -- 2.39.5