Bug 12416: add the test of DelUniqueDebarment
authorYohann Dufour <dufour.yohann@gmail.com>
Mon, 16 Jun 2014 07:13:35 +0000 (09:13 +0200)
committerTomas Cohen Arazi <tomascohen@gmail.com>
Sun, 22 Jun 2014 22:58:52 +0000 (19:58 -0300)
The subroutine DelUniqueDebarment was not tested

To test: execute the command prove t/db_dependent/Borrower_Debarments.t
The command has to print:
t/db_dependent/Borrower_Debarments.t .. ok
All tests successful.
Files=1, Tests=22,  2 wallclock secs ( 0.03 usr  0.01 sys +  1.43 cusr  0.07 csys =  1.54 CPU)
Result: PASS

Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Comments on last patch

Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
t/db_dependent/Borrower_Debarments.t

index 44d82b9..2f63fcf 100755 (executable)
@@ -5,7 +5,7 @@ use Modern::Perl;
 use C4::Context;
 use C4::Members;
 
-use Test::More tests => 21;
+use Test::More tests => 22;
 
 use_ok('Koha::Borrower::Debarments');
 
@@ -86,6 +86,17 @@ ok( @$debarments == 1, "GetDebarments returns 1 OVERDUES debarment after running
 ok( $debarments->[0]->{'expiration'} eq '9999-11-09', "AddOverduesDebarment updated OVERDUES debarment correctly" );
 
 
+DelUniqueDebarment({
+    borrowernumber => $borrowernumber,
+    type => 'OVERDUES',
+});
+$debarments = GetDebarments({
+    borrowernumber => $borrowernumber,
+    type => 'OVERDUES',
+});
+is( @$debarments, 0, "DelUniqueDebarment functions correctly" );
+
+
 $debarments = GetDebarments({ borrowernumber => $borrowernumber });
 foreach my $d ( @$debarments ) {
     DelDebarment( $d->{'borrower_debarment_id'} );