From 80ae1d4b28bb9a248bb780548b6fca79392c0f9a Mon Sep 17 00:00:00 2001
From: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Date: Mon, 23 Apr 2018 18:52:00 -0300
Subject: [PATCH] Bug 19204: Add a test: holiday is expiration date

---
 t/db_dependent/Circulation.t | 22 +++++++++++++++++++++-
 1 file changed, 21 insertions(+), 1 deletion(-)

diff --git a/t/db_dependent/Circulation.t b/t/db_dependent/Circulation.t
index 294e622611..d8de2e220b 100755
--- a/t/db_dependent/Circulation.t
+++ b/t/db_dependent/Circulation.t
@@ -1764,7 +1764,7 @@ subtest 'AddReturn + CumulativeRestrictionPeriods' => sub {
 };
 
 subtest 'AddReturn + suspension_chargeperiod' => sub {
-    plan tests => 10;
+    plan tests => 12;
 
     my $library = $builder->build( { source => 'Branch' } );
     my $patron  = $builder->build( { source => 'Borrower', value => { categorycode => $patron_category->{categorycode} } } );
@@ -1895,6 +1895,26 @@ subtest 'AddReturn + suspension_chargeperiod' => sub {
             expiration_date => $expected_expiration,
         }
     );
+
+    # Adding another holiday, day of expiration date
+    my $expected_expiration_dt = dt_from_string($expected_expiration);
+    $calendar->insert_single_holiday(
+        day             => $expected_expiration_dt->day,
+        month           => $expected_expiration_dt->month,
+        year            => $expected_expiration_dt->year,
+        title           => 'holidayTest_exp',
+        description     => 'holidayDesc on expiration date'
+    );
+    # Expiration date will be the day after
+    test_debarment_on_checkout(
+        {
+            item            => $item_1,
+            library         => $library,
+            patron          => $patron,
+            due_date        => $five_days_ago,
+            expiration_date => $expected_expiration_dt->clone->add( days => 1 ),
+        }
+    );
 };
 
 subtest 'AddReturn | is_overdue' => sub {
-- 
2.11.0