Permalink
Browse files

Fix Australia QLD unit tests

git-svn-id: http://svn.php.net/repository/pear/packages/Date_Holidays/trunk@321764 c90b9560-bf6c-de11-be94-00142212c4b1
  • Loading branch information...
1 parent 049d4d7 commit ce171b8e092b885fbf9cf5516de22e210e724b8b @CloCkWeRX CloCkWeRX committed Jan 4, 2012
Showing with 90 additions and 20 deletions.
  1. +70 −1 Date/Holidays/Driver/AustraliaQLD.php
  2. +20 −19 tests/Date_Holidays_Driver_AustraliaQLD_TestSuite.php
@@ -70,13 +70,82 @@ function _buildHolidays()
*/
$labourDay = Date_Calc::nWeekdayOfMonth(1, 1, 5, $this->_year);
$this->_addHoliday('labourDay', $labourDay, "Labour Day");
+ $this->_addTranslationForHoliday('labourDay', 'en_EN', 'Labour Day');
// Royal National Agricultural (RNA) Show Day (Brisbane only) usually held on second Wednesday in August except when there are five Wednesdays in August it is held on third Wednesday.
- $royalQueenslandShow = Date_Calc::nWeekdayOfMonth(2, 3, 8, $this->_year);
+ if (Date_Calc::nWeekdayOfMonth(5, 3, 8, $this->_year) !== -1) {
+ $royalQueenslandShow = Date_Calc::nWeekdayOfMonth(3, 3, 8, $this->_year);
+ } else {
+ $royalQueenslandShow = Date_Calc::nWeekdayOfMonth(2, 3, 8, $this->_year);
+ }
$this->_addHoliday('royalQueenslandShow', $royalQueenslandShow, "Royal Queensland Show"); // Brisbane area only
+ $this->_addTranslationForHoliday('royalQueenslandShow', 'en_EN', 'Royal Queensland Show');
+ /**
+ * Christmas and Boxing Day
+ */
+ $christmasDay = new Date($this->_year . '-12-25');
+ if ($christmasDay->getDayOfWeek() == 6) {
+ // 25 December - if that date falls on a Saturday the public holiday transfers to the following Monday.
+ $this->_addHoliday('christmasDay',
+ $this->_year . '-12-27',
+ 'Substitute Bank Holiday in lieu of Christmas Day');
+
+ } else if ($christmasDay->getDayOfWeek() == 0) {
+ // If that date falls on a Sunday that day and the following Monday will be public holidays.
+ $this->_addHoliday('christmasDay',
+ $this->_year . '-12-26',
+ 'Substitute Bank Holiday in lieu of Christmas Day');
+ } else {
+ $this->_addHoliday('christmasDay', $christmasDay, 'Christmas Day');
+ }
+
+ $boxingDay = new Date($this->_year . '-12-26');
+ if ($boxingDay->getDayOfWeek() == 6) {
+ //26 December - if that date falls on a Saturday the public holiday transfers to the following Monday.
+ $this->_addHoliday('boxingDay',
+ $this->_year . '-12-28',
+ 'Substitute Bank Holiday in lieu of Boxing Day');
+ } else if ($boxingDay->getDayOfWeek() == 0) {
+ // If that date falls on a Sunday that day and the following Tuesday will be public holidays.
+ $this->_addHoliday('boxingDay',
+ $this->_year . '-12-28',
+ 'Substitute Bank Holiday in lieu of Boxing Day');
+ } else if ($boxingDay->getDayOfWeek() == 1) {
+ // If that date falls on a Monday that day and the following Tuesday will be public holidays.
+ $this->_addHoliday('boxingDay',
+ $this->_year . '-12-26',
+ 'Substitute Bank Holiday in lieu of Boxing Day');
+ $this->_addHoliday('boxingDay',
+ $this->_year . '-12-27',
+ 'Substitute Bank Holiday in lieu of Boxing Day');
+ } else {
+ $this->_addHoliday('boxingDay', $this->_year . '-12-26', 'Boxing Day');
+ }
+
+ $this->_addTranslationForHoliday('christmasDay', 'en_EN', 'Christmas Day');
+ $this->_addTranslationForHoliday('boxingDay', 'en_EN', 'Boxing Day');
+
+
+ /*
+ * See http://en.wikipedia.org/wiki/Queen%27s_Official_Birthday#Australia
+ */
+ if ($this->_year < 2012) {
+ $queensBirthday = Date_Calc::nWeekdayOfMonth(2, 1, 6, $this->_year);
+ $this->_addHoliday('queensBirthday', $queensBirthday, "Queen's Birthday");
+ $this->_addTranslationForHoliday('queensBirthday', 'en_EN', "Queen's Birthday");
+ }
+ if ($this->_year == '2012') {
+ $this->_addHoliday('queensDiamondJubilee', Date_Calc::nWeekdayOfMonth(2, 1, 6, $this->_year), "Queen's Diamond Jubilee");
+ $this->_addTranslationForHoliday('queensDiamondJubilee', 'en_EN', "Queen's Diamond Jubilee");
+ }
+ if ($this->_year >= 2012) {
+ $queensBirthday = Date_Calc::nWeekdayOfMonth(1, 1, 10, $this->_year);
+ $this->_addHoliday('queensBirthday', $queensBirthday, "Queen's Birthday");
+ $this->_addTranslationForHoliday('queensBirthday', 'en_EN', "Queen's Birthday");
+ }
} // _buildHolidays()
} // Date_Holidays_Driver_AustraliaQLD
@@ -37,39 +37,40 @@ public static function data()
// 2008
$holidays[] = array("boxingDay", 2008, array('day' => 26, 'month' => 12, 'year' => 2008));
- $holidays[] = array("queensBirthday", 2008, array('day' => 09, 'month' => 06, 'year' => 2008));
- $holidays[] = array("labourDay", 2008, array('day' => 03, 'month' => 10, 'year' => 2008));
- $holidays[] = array("royalQueenslandShow", 2008, array('day' => 13, 'month' => 08, 'year' => 2008));
+ $holidays[] = array("queensBirthday", 2008, array('day' => 9, 'month' => 6, 'year' => 2008));
+ $holidays[] = array("labourDay", 2008, array('day' => 5, 'month' => 5, 'year' => 2008));
+ $holidays[] = array("royalQueenslandShow", 2008, array('day' => 13, 'month' => 8, 'year' => 2008));
// 2009
$holidays[] = array("boxingDay", 2009, array('day' => 28, 'month' => 12, 'year' => 2009));
- $holidays[] = array("queensBirthday", 2009, array('day' => 08, 'month' => 06, 'year' => 2009));
- $holidays[] = array("labourDay", 2009, array('day' => 03, 'month' => 10, 'year' => 2009));
- $holidays[] = array("royalQueenslandShow", 2009, array('day' => 12, 'month' => 08, 'year' => 2009));
+ $holidays[] = array("queensBirthday", 2009, array('day' => 8, 'month' => 6, 'year' => 2009));
+ $holidays[] = array("labourDay", 2009, array('day' => 4, 'month' => 5, 'year' => 2009));
+ $holidays[] = array("royalQueenslandShow", 2009, array('day' => 12, 'month' => 8, 'year' => 2009));
// 2010
- $holidays[] = array("boxingDay", 2010, array('day' => 27, 'month' => 12, 'year' => 2010));
- $holidays[] = array("queensBirthday", 2010, array('day' => 14, 'month' => 06, 'year' => 2010));
- $holidays[] = array("labourDay", 2010, array('day' => 03, 'month' => 10, 'year' => 2010));
- $holidays[] = array("royalQueenslandShow", 2010, array('day' => 11, 'month' => 08, 'year' => 2010));
+ $holidays[] = array("boxingDay", 2010, array('day' => 28, 'month' => 12, 'year' => 2010));
+ $holidays[] = array("queensBirthday", 2010, array('day' => 14, 'month' => 6, 'year' => 2010));
+ $holidays[] = array("labourDay", 2010, array('day' => 3, 'month' => 5, 'year' => 2010));
+ $holidays[] = array("royalQueenslandShow", 2010, array('day' => 11, 'month' => 8, 'year' => 2010));
// 2011
$holidays[] = array("boxingDay", 2011, array('day' => 27, 'month' => 12, 'year' => 2011));
- $holidays[] = array("queensBirthday", 2011, array('day' => 13, 'month' => 06, 'year' => 2011));
- $holidays[] = array("labourDay", 2011, array('day' => 03, 'month' => 10, 'year' => 2011));
- $holidays[] = array("royalQueenslandShow", 2011, array('day' => 17, 'month' => 08, 'year' => 2011));
+ $holidays[] = array("queensBirthday", 2011, array('day' => 13, 'month' => 6, 'year' => 2011));
+ $holidays[] = array("labourDay", 2011, array('day' => 2, 'month' => 5, 'year' => 2011));
+ $holidays[] = array("royalQueenslandShow", 2011, array('day' => 17, 'month' => 8, 'year' => 2011));
// 2012
$holidays[] = array("boxingDay", 2012, array('day' => 26, 'month' => 12, 'year' => 2012));
- $holidays[] = array("queensBirthday", 2012, array('day' => 11, 'month' => 06, 'year' => 2012));
- $holidays[] = array("labourDay", 2012, array('day' => 1, 'month' => 10, 'year' => 2012));
- $holidays[] = array("royalQueenslandShow", 2012, array('day' => 15, 'month' => 08, 'year' => 2012));
+ $holidays[] = array("queensDiamondJubilee", 2012, array('day' => 11, 'month' => 6, 'year' => 2012));
+ $holidays[] = array("queensBirthday", 2012, array('day' => 1, 'month' => 10, 'year' => 2012));
+ $holidays[] = array("labourDay", 2012, array('day' => 7, 'month' => 5, 'year' => 2012));
+ $holidays[] = array("royalQueenslandShow", 2012, array('day' => 15, 'month' => 8, 'year' => 2012));
// 2013
$holidays[] = array("boxingDay", 2013, array('day' => 26, 'month' => 12, 'year' => 2013));
- $holidays[] = array("queensBirthday", 2013, array('day' => 10, 'month' => 06, 'year' => 2013));
- $holidays[] = array("labourDay", 2013, array('day' => 7, 'month' => 10, 'year' => 2013));
- $holidays[] = array("royalQueenslandShow", 2013, array('day' => 14, 'month' => 08, 'year' => 2013));
+ $holidays[] = array("queensBirthday", 2013, array('day' => 7, 'month' => 10, 'year' => 2013));
+ $holidays[] = array("labourDay", 2013, array('day' => 6, 'month' => 5, 'year' => 2013));
+ $holidays[] = array("royalQueenslandShow", 2013, array('day' => 14, 'month' => 8, 'year' => 2013));
return $holidays;
}

0 comments on commit ce171b8

Please sign in to comment.