Bug 12801 - Unit Test
authorKyle M Hall <kyle@bywatersolutions.com>
Thu, 21 Aug 2014 13:47:37 +0000 (09:47 -0400)
committerTomas Cohen Arazi <tomascohen@gmail.com>
Sat, 18 Oct 2014 13:24:56 +0000 (10:24 -0300)
Signed-off-by: Brendan Gallagher <brendan@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
t/db_dependent/Holidays.t

index 9d41105..5941691 100755 (executable)
@@ -5,7 +5,8 @@ use DateTime;
 use DateTime::TimeZone;
 
 use C4::Context;
-use Test::More tests => 10;
+use Koha::DateUtils;
+use Test::More tests => 12;
 
 BEGIN { use_ok('Koha::Calendar'); }
 BEGIN { use_ok('C4::Calendar'); }
@@ -53,3 +54,13 @@ is( $koha_calendar->is_holiday($custom_holiday), 0, '2013-11-10 does not start o
 $koha_calendar->add_holiday($custom_holiday);
 is( $koha_calendar->is_holiday($custom_holiday), 1, 'able to add holiday for testing' );
 
+my $today = dt_from_string();
+C4::Calendar->new( branchcode => 'CPL' )->insert_single_holiday(
+    day         => $today->day(),
+    month       => $today->month(),
+    year        => $today->year(),
+    title       => "$today",
+    description => "$today",
+);
+is( Koha::Calendar->new( branchcode => 'CPL' )->is_holiday( $today ), 1, "Today is a holiday for CPL" );
+is( Koha::Calendar->new( branchcode => 'MPL' )->is_holiday( $today ), 0, "Today is not a holiday for MPL");