Permalink
Browse files

Fix Australia WA unit tests

git-svn-id: http://svn.php.net/repository/pear/packages/Date_Holidays/trunk@321765 c90b9560-bf6c-de11-be94-00142212c4b1
  • Loading branch information...
1 parent ce171b8 commit ae6b3a8d3bf32e6ecb9e6713a92676aee5c5cfa4 @CloCkWeRX CloCkWeRX committed Jan 4, 2012
Showing with 56 additions and 7 deletions.
  1. +49 −0 Date/Holidays/Driver/AustraliaWA.php
  2. +7 −7 tests/Date_Holidays_Driver_AustraliaWA_TestSuite.php
@@ -61,13 +61,15 @@ function _buildHolidays()
*/
$labourDay = Date_Calc::nWeekdayOfMonth(1, 1, 3, $this->_year);
$this->_addHoliday('labourDay', $labourDay, "Labour Day");
+ $this->_addTranslationForHoliday('labourDay', 'en_EN', "Labour Day");
/*
* Foundation Day (Queen's Birthday in other states).
* See http://en.wikipedia.org/wiki/Queen%27s_Official_Birthday#Australia
*/
$foundationDay = Date_Calc::nWeekdayOfMonth(1, 1, 6, $this->_year);
$this->_addHoliday('foundationDay', $foundationDay, "Foundation Day");
+ $this->_addTranslationForHoliday('foundationDay', 'en_EN', "Foundation Day");
/*
* The Queen's Birthday. There is no firm rule to determine this date before
@@ -96,6 +98,53 @@ function _buildHolidays()
}
}
$this->_addHoliday('queensBirthday', $queensBirthday, "Queen's Birthday");
+ $this->_addTranslationForHoliday('queensBirthday', 'en_EN', "Queen's Birthday");
+
+
+ /**
+ * 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');
} // _buildHolidays()
@@ -35,34 +35,34 @@ public static function data()
$holidays = array();
//2009
- $holidays[] = array("labourDay", 2009, array('day' => 2, 'month' => 5, 'year' => 2009));
+ $holidays[] = array("labourDay", 2009, array('day' => 2, 'month' => 3, 'year' => 2009));
$holidays[] = array("foundationDay", 2009, array('day' => 1, 'month' => 6, 'year' => 2009));
$holidays[] = array("queensBirthday", 2009, array('day' => 28, 'month' => 9, 'year' => 2009));//Non-metropolitan local authorities may celebrate the Queen's Birthday Public Holiday on and alternative date
- $holidays[] = array("boxingDay", 2009, array('day' => 26, 'month' => 12, 'year' => 2009));
+ $holidays[] = array("boxingDay", 2009, array('day' => 28, 'month' => 12, 'year' => 2009));
// 2010
- $holidays[] = array("labourDay", 2010, array('day' => 1, 'month' => 5, 'year' => 2010));
+ $holidays[] = array("labourDay", 2010, array('day' => 1, 'month' => 3, 'year' => 2010));
$holidays[] = array("foundationDay", 2010, array('day' => 7, 'month' => 6, 'year' => 2010));
$holidays[] = array("queensBirthday", 2010, array('day' => 27, 'month' => 9, 'year' => 2010));//Non-metropolitan local authorities may celebrate the Queen's Birthday Public Holiday on and alternative date
- $holidays[] = array("boxingDay", 2010, array('day' => 26, 'month' => 12, 'year' => 2010));
+ $holidays[] = array("boxingDay", 2010, array('day' => 28, 'month' => 12, 'year' => 2010));
// 2011
- $holidays[] = array("labourDay", 2011, array('day' => 7, 'month' => 5, 'year' => 2011));
+ $holidays[] = array("labourDay", 2011, array('day' => 7, 'month' => 3, 'year' => 2011));
$holidays[] = array("foundationDay", 2011, array('day' => 6, 'month' => 6, 'year' => 2011));
//The date of the Queen's Birthday public holiday for 2011 has been changed from Monday 3 October to Friday 28 October 2011 - 1/03/2011
$holidays[] = array("queensBirthday", 2011, array('day' => 28, 'month' => 10, 'year' => 2011));//Non-metropolitan local authorities may celebrate the Queen's Birthday Public Holiday on and alternative date
$holidays[] = array("boxingDay", 2011, array('day' => 27, 'month' => 12, 'year' => 2011));
// 2012
- $holidays[] = array("labourDay", 2012, array('day' => 5, 'month' => 5, 'year' => 2012));
+ $holidays[] = array("labourDay", 2012, array('day' => 5, 'month' => 3, 'year' => 2012));
$holidays[] = array("foundationDay", 2012, array('day' => 4, 'month' => 6, 'year' => 2012));
$holidays[] = array("queensBirthday", 2012, array('day' => 1, 'month' => 10, 'year' => 2012));//Non-metropolitan local authorities may celebrate the Queen's Birthday Public Holiday on and alternative date
$holidays[] = array("boxingDay", 2012, array('day' => 26, 'month' => 12, 'year' => 2012));
// 2013
- $holidays[] = array("labourDay", 2013, array('day' => 4, 'month' => 5, 'year' => 2013));
+ $holidays[] = array("labourDay", 2013, array('day' => 4, 'month' => 3, 'year' => 2013));
$holidays[] = array("foundationDay", 2013, array('day' => 3, 'month' => 6, 'year' => 2013));
$holidays[] = array("queensBirthday", 2013, array('day' => 30, 'month' => 9, 'year' => 2013));//Non-metropolitan local authorities may celebrate the Queen's Birthday Public Holiday on and alternative date
$holidays[] = array("boxingDay", 2013, array('day' => 26, 'month' => 12, 'year' => 2013));

0 comments on commit ae6b3a8

Please sign in to comment.