Bugzilla – Attachment 13634 Details for
Bug 9074
DB dependent tests for is_holiday
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 9074 - DB dependent tests for is_holiday
Bug-9074---DB-dependent-tests-for-isholiday.patch (text/plain), 9.90 KB, created by
Tomás Cohen Arazi (tcohen)
on 2012-11-22 12:09:08 UTC
(
hide
)
Description:
Bug 9074 - DB dependent tests for is_holiday
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi (tcohen)
Created:
2012-11-22 12:09:08 UTC
Size:
9.90 KB
patch
obsolete
>From 049b5fc6ef1bd7cc641dde3f6918ba1a81893ab1 Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@gmail.com> >Date: Wed, 14 Nov 2012 14:21:47 -0300 >Subject: [PATCH] Bug 9074 - DB dependent tests for is_holiday >MIME-Version: 1.0 >Content-Type: text/plain; charset=UTF-8 >Content-Transfer-Encoding: 8bit > >Some DB dependent tests for: > >- Special holidays >- Exception holidays > >I added a test for a bug introduced by 8966. >Languages that don't provide the MPL branch in their sample data are ommited. > >Sponsored-by: Universidad Nacional de Córdoba >Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> >--- > .../data/mysql/de-DE/optional/sample_holidays.sql | 2 ++ > .../data/mysql/de-DE/optional/sample_holidays.txt | 4 +++ > .../data/mysql/en/optional/sample_holidays.sql | 2 ++ > .../data/mysql/en/optional/sample_holidays.txt | 6 +++- > .../data/mysql/es-ES/optional/sample_holidays.sql | 2 ++ > .../data/mysql/es-ES/optional/sample_holidays.txt | 6 +++- > .../data/mysql/it-IT/necessari/sample_holidays.sql | 2 +- > .../mysql/nb-NO/2-Valgfritt/sample_holidays.sql | 2 ++ > .../mysql/nb-NO/2-Valgfritt/sample_holidays.txt | 7 +++++ > .../data/mysql/pl-PL/optional/sample_holidays.sql | 2 ++ > .../data/mysql/pl-PL/optional/sample_holidays.txt | 4 +++ > installer/data/mysql/ru-RU/optional/holidays.txt | 5 ++- > t/db_dependent/Holidays.t | 32 +++++++++++++++++++- > 13 files changed, 71 insertions(+), 5 deletions(-) > >diff --git a/installer/data/mysql/de-DE/optional/sample_holidays.sql b/installer/data/mysql/de-DE/optional/sample_holidays.sql >index cae733b..5acf560 100644 >--- a/installer/data/mysql/de-DE/optional/sample_holidays.sql >+++ b/installer/data/mysql/de-DE/optional/sample_holidays.sql >@@ -3,3 +3,5 @@ INSERT INTO `repeatable_holidays` VALUES > (3,'',NULL,1,1,'','Neujahr'), > (4,'',NULL,25,12,'','1. Weihnachtsfeiertag'), > (5,'',NULL,26,12,'','2. Weihnachtsfeiertag'); >+INSERT INTO `special_holidays` VALUES ('','MPL',16,11,2012,0,'Sample single holiday','This holiday is here for testing purposes only.'); >+INSERT INTO `special_holidays` VALUES ('','MPL',11,11,2012,1,'Sample sunday exception','This holiday exception is here for testing purposes only.'); >diff --git a/installer/data/mysql/de-DE/optional/sample_holidays.txt b/installer/data/mysql/de-DE/optional/sample_holidays.txt >index 947baea..cc8e127 100644 >--- a/installer/data/mysql/de-DE/optional/sample_holidays.txt >+++ b/installer/data/mysql/de-DE/optional/sample_holidays.txt >@@ -2,3 +2,7 @@ Beispiele für SchlieÃtage: > Sonntag > 1. und 2. Weihnachtsfeiertag > Neujahr >+Sample single holidays: >+ 16-11-2012 >+Sample holiday exceptions: >+ 11-11-2012 (Sunday exception) >diff --git a/installer/data/mysql/en/optional/sample_holidays.sql b/installer/data/mysql/en/optional/sample_holidays.sql >index 33b6ff6..781ce2c 100644 >--- a/installer/data/mysql/en/optional/sample_holidays.sql >+++ b/installer/data/mysql/en/optional/sample_holidays.sql >@@ -2,3 +2,5 @@ INSERT INTO `repeatable_holidays` VALUES > (2,'MPL',0,NULL,NULL,'','Sundays'), > (3,'MPL',NULL,1,1,'','New Year\'s Day'), > (4,'MPL',NULL,25,12,'','Christmas'); >+INSERT INTO `special_holidays` VALUES ('','MPL',16,11,2012,0,'Sample single holiday','This holiday is here for testing purposes only.'); >+INSERT INTO `special_holidays` VALUES ('','MPL',11,11,2012,1,'Sample sunday exception','This holiday exception is here for testing purposes only.'); >diff --git a/installer/data/mysql/en/optional/sample_holidays.txt b/installer/data/mysql/en/optional/sample_holidays.txt >index a2d2de9..e28df43 100644 >--- a/installer/data/mysql/en/optional/sample_holidays.txt >+++ b/installer/data/mysql/en/optional/sample_holidays.txt >@@ -1,4 +1,8 @@ >-Sample holidays: >+Sample repeatable holidays: > Sundays > Christmas > New Year's >+Sample single holidays: >+ 16-11-2012 >+Sample holiday exceptions: >+ 11-11-2012 (Sunday exception) >diff --git a/installer/data/mysql/es-ES/optional/sample_holidays.sql b/installer/data/mysql/es-ES/optional/sample_holidays.sql >index e323317..77daf35 100644 >--- a/installer/data/mysql/es-ES/optional/sample_holidays.sql >+++ b/installer/data/mysql/es-ES/optional/sample_holidays.sql >@@ -2,3 +2,5 @@ INSERT INTO `repeatable_holidays` VALUES > (2,'',0,NULL,NULL,'','Sundays'), > (3,'',NULL,1,1,'','New Year\'s Day'), > (4,'',NULL,25,12,'','Christmas'); >+INSERT INTO `special_holidays` VALUES ('','MPL',16,11,2012,0,'Sample single holiday','This holiday is here for testing purposes only.'); >+INSERT INTO `special_holidays` VALUES ('','MPL',11,11,2012,1,'Sample sunday exception','This holiday exception is here for testing purposes only.'); >diff --git a/installer/data/mysql/es-ES/optional/sample_holidays.txt b/installer/data/mysql/es-ES/optional/sample_holidays.txt >index 1767301..3ed73bb 100644 >--- a/installer/data/mysql/es-ES/optional/sample_holidays.txt >+++ b/installer/data/mysql/es-ES/optional/sample_holidays.txt >@@ -1,4 +1,8 @@ >-Feriados de ejemplo: >+Feriados repetibles de ejemplo: > Domingos > Navidad > Año nuevo >+Sample single holidays: >+ 16-11-2012 >+Sample holiday exceptions: >+ 11-11-2012 (Sunday exception) >diff --git a/installer/data/mysql/it-IT/necessari/sample_holidays.sql b/installer/data/mysql/it-IT/necessari/sample_holidays.sql >index 67640a9..7e658c7 100644 >--- a/installer/data/mysql/it-IT/necessari/sample_holidays.sql >+++ b/installer/data/mysql/it-IT/necessari/sample_holidays.sql >@@ -5,4 +5,4 @@ INSERT INTO `repeatable_holidays` VALUES > (3,'',NULL,1,1,'','Nuovo anno'), > (4,'',NULL,25,12,'','Natale'); > >-SET FOREIGN_KEY_CHECKS=1; >\ No newline at end of file >+SET FOREIGN_KEY_CHECKS=1; >diff --git a/installer/data/mysql/nb-NO/2-Valgfritt/sample_holidays.sql b/installer/data/mysql/nb-NO/2-Valgfritt/sample_holidays.sql >index 7df9e67..0a70f95 100644 >--- a/installer/data/mysql/nb-NO/2-Valgfritt/sample_holidays.sql >+++ b/installer/data/mysql/nb-NO/2-Valgfritt/sample_holidays.sql >@@ -26,3 +26,5 @@ INSERT INTO `repeatable_holidays` VALUES > (5,'',NULL,17,5,'','17. mai'), > (6,'',NULL,25,12,'','1. juledag'), > (7,'',NULL,26,12,'','2. juledag'); >+INSERT INTO `special_holidays` VALUES ('','MPL',16,11,2012,0,'Sample single holiday','This holiday is here for testing purposes only.'); >+INSERT INTO `special_holidays` VALUES ('','MPL',11,11,2012,1,'Sample sunday exception','This holiday exception is here for testing purposes only.'); >diff --git a/installer/data/mysql/nb-NO/2-Valgfritt/sample_holidays.txt b/installer/data/mysql/nb-NO/2-Valgfritt/sample_holidays.txt >index 33b1e12..7755275 100644 >--- a/installer/data/mysql/nb-NO/2-Valgfritt/sample_holidays.txt >+++ b/installer/data/mysql/nb-NO/2-Valgfritt/sample_holidays.txt >@@ -1 +1,8 @@ > Eksempler pÃ¥ fridager. >+ Sundays >+ Christmas >+ New Year's >+Sample single holidays: >+ 16-11-2012 >+Sample holiday exceptions: >+ 11-11-2012 (Sunday exception) >diff --git a/installer/data/mysql/pl-PL/optional/sample_holidays.sql b/installer/data/mysql/pl-PL/optional/sample_holidays.sql >index bee37b5..77da0a5 100644 >--- a/installer/data/mysql/pl-PL/optional/sample_holidays.sql >+++ b/installer/data/mysql/pl-PL/optional/sample_holidays.sql >@@ -2,3 +2,5 @@ INSERT INTO `repeatable_holidays` VALUES > (2,'',0,NULL,NULL,'','Niedziele'), > (3,'',NULL,1,1,'','Nowy Rok'), > (4,'',NULL,25,12,'','Boże Narodzenie'); >+INSERT INTO `special_holidays` VALUES ('','MPL',16,11,2012,0,'Sample single holiday','This holiday is here for testing purposes only.'); >+INSERT INTO `special_holidays` VALUES ('','MPL',11,11,2012,1,'Sample sunday exception','This holiday exception is here for testing purposes only.'); >diff --git a/installer/data/mysql/pl-PL/optional/sample_holidays.txt b/installer/data/mysql/pl-PL/optional/sample_holidays.txt >index 520d200..63e8b9e 100644 >--- a/installer/data/mysql/pl-PL/optional/sample_holidays.txt >+++ b/installer/data/mysql/pl-PL/optional/sample_holidays.txt >@@ -2,3 +2,7 @@ PrzykÅadowe dni wolne: > Niedziele > Boże Narodzenie > Nowy Rok >+Sample single holidays: >+ 16-11-2012 >+Sample holiday exceptions: >+ 11-11-2012 (Sunday exception) >diff --git a/installer/data/mysql/ru-RU/optional/holidays.txt b/installer/data/mysql/ru-RU/optional/holidays.txt >index a17a295..fbd7a2c 100644 >--- a/installer/data/mysql/ru-RU/optional/holidays.txt >+++ b/installer/data/mysql/ru-RU/optional/holidays.txt >@@ -1 +1,4 @@ >-ÐовÑоÑÑемÑе пÑаздники. >\ No newline at end of file >+ÐовÑоÑÑемÑе пÑаздники. >+ Sundays >+ Christmas >+ New Year's >diff --git a/t/db_dependent/Holidays.t b/t/db_dependent/Holidays.t >index 5c4da1b..b0be7c6 100755 >--- a/t/db_dependent/Holidays.t >+++ b/t/db_dependent/Holidays.t >@@ -5,7 +5,7 @@ use DateTime; > use DateTime::TimeZone; > > use C4::Context; >-use Test::More tests => 8; >+use Test::More tests => 11; > > BEGIN { use_ok('Koha::Calendar'); } > BEGIN { use_ok('C4::Calendar'); } >@@ -39,7 +39,37 @@ my $newyear = DateTime->new( > day => 1, > ); > >+my $special_holiday = DateTime->new( >+ year => 2012, >+ month => 11, >+ day => 16 >+); >+ >+my $exception_sunday = DateTime->new( >+ year => 2012, >+ month => 11, >+ day => 11 >+); >+ > is( $koha_calendar->is_holiday($sunday), 1, 'Sunday is a closed day' ); > is( $koha_calendar->is_holiday($monday), 0, 'Monday is not a closed day' ); > is( $koha_calendar->is_holiday($christmas), 1, 'Christmas is a closed day' ); > is( $koha_calendar->is_holiday($newyear), 1, 'New Years day is a closed day' ); >+is( $koha_calendar->is_holiday($special_holiday), 1, 'Sample single holiday is a closed day' ); >+is( $koha_calendar->is_holiday($exception_sunday), 0, 'Sample sunday exception is not a closed day' ); >+ >+ >+# is_holiday truncates the date to day as that's >+# how they are stored/retreived from db. This is a >+# regression test for a bug introduced by 8966, fixed in 8800 >+my $special_holiday_time = DateTime->new( >+ year => 2012, >+ month => 11, >+ day => 16, >+ hour => 11, >+ minute => 2 >+); >+ >+is( $koha_calendar->is_holiday($special_holiday_time), >+ $koha_calendar->is_holiday($special_holiday) , >+ 'is_holiday should truncate the date for holiday validation' ); >-- >1.7.10.4
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 9074
:
13451
|
13586
|
13587
|
13609
| 13634