From 5b23873ead2b5345802276959619fe2a67dfe46c Mon Sep 17 00:00:00 2001 From: Tomas Cohen Arazi Date: Tue, 28 Jun 2016 10:57:38 -0300 Subject: [PATCH] [SIGNED-OFF]Bug 16819: Unit tests for C4::Members::DelMember The C4::Members::DelMember function actually deletes reserves, and it is not properly tested. To test: - Apply the patch - Run: $ prove t/db_dependent/Members.t => SUCCESS: Tests pass - Sign off Sponsored-by: NEKLS Signed-off-by: Hector Castro --- t/db_dependent/Members.t | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/t/db_dependent/Members.t b/t/db_dependent/Members.t index 797e9bc..006207b 100755 --- a/t/db_dependent/Members.t +++ b/t/db_dependent/Members.t @@ -17,11 +17,12 @@ use Modern::Perl; -use Test::More tests => 77; +use Test::More tests => 79; use Test::MockModule; use Data::Dumper; use C4::Context; use Koha::Database; +use Koha::Holds; use Koha::List::Patron; @@ -167,10 +168,20 @@ ModMember(borrowernumber => $member->{'borrowernumber'}, dateexpiry => '2001-01- $member = GetMemberDetails($member->{'borrowernumber'}); ok($member->{is_expired}, "GetMemberDetails() indicates that patron is expired"); -# clean up +# Create a reserve for the patron +$builder->build({ + source => 'Reserve', + value => { + borrowernumber => $member->{ borrowernumber } + } +}); +is( Koha::Holds->search({ borrowernumber => $member->{borrowernumber} })->count, + 1, 'Hold created correctly' ); DelMember($member->{borrowernumber}); my $borrower = GetMember( cardnumber => $CARDNUMBER ); is( $borrower, undef, 'DelMember should remove the patron' ); +is( Koha::Holds->search({ borrowernumber => $member->{borrowernumber} })->count, + 0, 'Hold deleted correctly' ); # Check_Userid tests %data = ( -- 1.7.10.4