Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Massive changes to get test suite in working order (there are tons of…

… failing tests, though).

git-svn-id: http://svn.php.net/repository/pear/packages/Date_Holidays/trunk@321621 c90b9560-bf6c-de11-be94-00142212c4b1
  • Loading branch information...
commit 32b2b5445ae942e5b2764182bbe1b5ad26bab1b4 1 parent 901e7b6
Daniel Convissor authored

Showing 43 changed files with 309 additions and 405 deletions. Show diff stats Hide diff stats

  1. +3 2 package.xml
  2. +1 3 package_finland.xml
  3. +1 3 package_japan.xml
  4. +1 3 package_sweden.xml
  5. +2 13 tests/AllTests.php
  6. +14 12 tests/AllTestsUndeployed.php
  7. +3 10 tests/Date_Holidays_Bugfix_Retests_TestSuite.php
  8. +4 9 tests/Date_Holidays_Driver_AustraliaNSW_TestSuite.php
  9. +5 10 tests/Date_Holidays_Driver_AustraliaQLD_TestSuite.php
  10. +5 10 tests/Date_Holidays_Driver_AustraliaSA_TestSuite.php
  11. +4 9 tests/Date_Holidays_Driver_AustraliaWA_TestSuite.php
  12. +5 10 tests/Date_Holidays_Driver_Australia_TestSuite.php
  13. +6 14 tests/Date_Holidays_Driver_Austria_TestSuite.php
  14. +4 9 tests/Date_Holidays_Driver_Brazil_TestSuite.php
  15. +6 14 tests/Date_Holidays_Driver_Christian_TestSuite.php
  16. +2 4 tests/Date_Holidays_Driver_Denmark_TestSuite.php
  17. +2 4 tests/Date_Holidays_Driver_Discordian_TestSuite.php
  18. +3 7 tests/Date_Holidays_Driver_EnglandWales_TestSuite.php
  19. +6 15 tests/Date_Holidays_Driver_Finland_TestSuite.php
  20. +7 17 tests/Date_Holidays_Driver_Germany_TestSuite.php
  21. +2 4 tests/Date_Holidays_Driver_Iceland_TestSuite.php
  22. +2 4 tests/Date_Holidays_Driver_Ireland_TestSuite.php
  23. +2 4 tests/Date_Holidays_Driver_Italy_TestSuite.php
  24. +24 26 tests/Date_Holidays_Driver_Japan_TestSuite.php
  25. +2 4 tests/Date_Holidays_Driver_Jewish_TestSuite.php
  26. +2 4 tests/Date_Holidays_Driver_Netherlands_TestSuite.php
  27. +2 4 tests/Date_Holidays_Driver_Norway_TestSuite.php
  28. +2 4 tests/Date_Holidays_Driver_PHPdotNet_TestSuite.php
  29. +4 9 tests/Date_Holidays_Driver_Portugal_TestSuite.php
  30. +8 13 tests/Date_Holidays_Driver_Romania_TestSuite.php
  31. +2 4 tests/Date_Holidays_Driver_Slovenia_TestSuite.php
  32. +4 9 tests/Date_Holidays_Driver_Spain_TestSuite.php
  33. +25 51 tests/Date_Holidays_Driver_Sweden_TestSuite.php
  34. +2 4 tests/Date_Holidays_Driver_Template_TestSuite.php
  35. +65 54 tests/Date_Holidays_Driver_TestSuite.php
  36. +2 4 tests/Date_Holidays_Driver_UNO_TestSuite.php
  37. +2 4 tests/Date_Holidays_Driver_USA_TestSuite.php
  38. +6 14 tests/Date_Holidays_Driver_Ukraine_TestSuite.php
  39. +57 0 tests/helper.inc
  40. +1 2  tests/testHolidays2005stampsAndSavingsDay.php
  41. +2 1  tests/test_UkraineRomanianHolidays.php
  42. +3 2 tests/test_getHolidays.php
  43. +4 2 tests/test_missingLocale.php
5 package.xml
@@ -88,9 +88,10 @@
88 88 </dir> <!-- /lang/Christian -->
89 89 </dir> <!-- /lang -->
90 90 <dir name="tests">
91   - <file baseinstalldir="Date" name="AllTests.php" role="test">
92   - <tasks:replace from="@test_dir@" to="test_dir" type="pear-config" />
  91 + <file baseinstalldir="Date" name="helper.inc" role="test">
  92 + <tasks:replace from="@data_dir@" to="data_dir" type="pear-config" />
93 93 </file>
  94 + <file baseinstalldir="Date" name="AllTests.php" role="test" />
94 95 <file baseinstalldir="Date" name="AllTestsUndeployed.php" role="test" />
95 96 <file baseinstalldir="Date" name="Date_Holidays_Bugfix_Retests_TestSuite.php" role="test" />
96 97 <file baseinstalldir="Date" name="Date_Holidays_Driver_Christian_TestSuite.php" role="test" />
4 package_finland.xml
@@ -36,9 +36,7 @@
36 36 </dir> <!-- /Holidays -->
37 37 </dir>
38 38 <dir name="tests">
39   - <file name="Date_Holidays_Driver_Finland_TestSuite.php" role="test">
40   - <tasks:replace from="@DATA-DIR@" to="data_dir" type="pear-config" />
41   - </file>
  39 + <file name="Date_Holidays_Driver_Finland_TestSuite.php" role="test" />
42 40 </dir> <!-- /tests -->
43 41 </dir> <!-- / -->
44 42 </contents>
4 package_japan.xml
@@ -44,9 +44,7 @@
44 44 </dir> <!-- /lang/Japan -->
45 45 </dir> <!-- /lang -->
46 46 <dir name="tests">
47   - <file name="Date_Holidays_Driver_Japan_TestSuite.php" role="test">
48   - <tasks:replace from="@DATA-DIR@" to="data_dir" type="pear-config" />
49   - </file>
  47 + <file name="Date_Holidays_Driver_Japan_TestSuite.php" role="test"/>
50 48 </dir> <!-- /tests -->
51 49 </dir> <!-- / -->
52 50 </contents>
4 package_sweden.xml
@@ -62,9 +62,7 @@
62 62 </dir> <!-- /lang/Sweden -->
63 63 </dir> <!-- /lang -->
64 64 <dir name="tests">
65   - <file name="Date_Holidays_Driver_Sweden_TestSuite.php" role="test">
66   - <tasks:replace from="@DATA-DIR@" to="data_dir" type="pear-config" />
67   - </file>
  65 + <file name="Date_Holidays_Driver_Sweden_TestSuite.php" role="test" />
68 66 </dir> <!-- /tests -->
69 67 </dir> <!-- / -->
70 68 </contents>
15 tests/AllTests.php
@@ -15,19 +15,8 @@
15 15 define('PHPUnit_MAIN_METHOD', 'Date_Holidays_AllTests::main');
16 16 }
17 17
18   -if (! $fp = @fopen('Date.php', 'r', true)) {
19   - die("PEAR_Date is required for these tests to run.\n");
20   -}
21   -
22   -if ($fp = @fopen('PHPUnit/Autoload.php', 'r', true)) {
23   - require_once 'PHPUnit/Autoload.php';
24   -} elseif ($fp = @fopen('PHPUnit/Framework.php', 'r', true)) {
25   - require_once 'PHPUnit/Framework.php';
26   - require_once 'PHPUnit/TextUI/TestRunner.php';
27   -} else {
28   - die('skip could not find PHPUnit');
29   -}
30   -fclose($fp);
  18 +/** Set up the environment */
  19 +require_once dirname(__FILE__) . '/helper.inc';
31 20
32 21 $dir = dirname(__FILE__);
33 22 require_once "$dir/Date_Holidays_TestSuite.php";
26 tests/AllTestsUndeployed.php
@@ -16,19 +16,21 @@
16 16 define('PHPUnit_MAIN_METHOD', 'AllTestsUndeployed::main');
17 17 }
18 18
19   -require_once 'PHPUnit/TextUI/TestRunner.php';
  19 +/** Set up the environment */
  20 +require_once dirname(__FILE__) . '/helper.inc';
20 21
21   -require_once 'Date_Holidays_TestSuite.php';
22   -require_once 'Date_Holidays_Driver_TestSuite.php';
23   -require_once 'Date_Holidays_Bugfix_Retests_TestSuite.php';
24   -require_once 'Date_Holidays_Driver_Christian_TestSuite.php';
25   -require_once 'Date_Holidays_Driver_Germany_TestSuite.php';
26   -require_once 'Date_Holidays_Driver_Jewish_TestSuite.php';
27   -require_once 'Date_Holidays_Driver_PHPdotNet_TestSuite.php';
28   -require_once 'Date_Holidays_Driver_UNO_TestSuite.php';
29   -require_once 'Date_Holidays_Driver_USA_TestSuite.php';
30   -require_once 'Date_Holidays_Driver_Sweden_TestSuite.php';
31   -require_once 'Date_Holidays_Driver_Finland_TestSuite.php';
  22 +$dir = dirname(__FILE__);
  23 +require_once "$dir/Date_Holidays_TestSuite.php";
  24 +require_once "$dir/Date_Holidays_Driver_TestSuite.php";
  25 +require_once "$dir/Date_Holidays_Bugfix_Retests_TestSuite.php";
  26 +require_once "$dir/Date_Holidays_Driver_Christian_TestSuite.php";
  27 +require_once "$dir/Date_Holidays_Driver_Germany_TestSuite.php";
  28 +require_once "$dir/Date_Holidays_Driver_Jewish_TestSuite.php";
  29 +require_once "$dir/Date_Holidays_Driver_PHPdotNet_TestSuite.php";
  30 +require_once "$dir/Date_Holidays_Driver_UNO_TestSuite.php";
  31 +require_once "$dir/Date_Holidays_Driver_USA_TestSuite.php";
  32 +require_once "$dir/Date_Holidays_Driver_Sweden_TestSuite.php";
  33 +require_once "$dir/Date_Holidays_Driver_Finland_TestSuite.php";
32 34
33 35 /**
34 36 * a test class for running all Date_Holidays unit tests whilst the package is undeployed.
13 tests/Date_Holidays_Bugfix_Retests_TestSuite.php
@@ -12,13 +12,9 @@
12 12 * @version CVS: $Id$
13 13 * @link http://pear.php.net/package/Date_Holidays
14 14 */
15   -if (!defined("PHPUnit_MAIN_METHOD")) {
16   - define("PHPUnit_MAIN_METHOD", "Date_HolidaysTest::main");
17   -}
18 15
19   -//make cvs testing work
20   -chdir(dirname(__FILE__) . '/../');
21   -require_once 'Date/Holidays.php';
  16 +/** Set up the environment */
  17 +require_once dirname(__FILE__) . '/helper.inc';
22 18
23 19 /**
24 20 * Test class for running unit tests that make sure bugs that have been
@@ -50,13 +46,10 @@ function setUp() {}
50 46 */
51 47 function testBug12807()
52 48 {
53   - $message = '';
54 49 $drv = Date_Holidays::factory('Denmark');
55   - $this->assertFalse(Date_Holidays::isError($drv));
56 50 if (Date_Holidays::isError($drv)) {
57   - $message = $drv->getMessage();
  51 + $this->fail(helper_get_error_message($drv));
58 52 }
59   - $this->assertFalse(Date_Holidays::isError($drv), $message);
60 53
61 54 $this->assertTrue($drv->isHoliday(mktime(1, 1, 1, 12, 25, 2007)));
62 55 $this->assertTrue($drv->isHoliday(mktime(1, 1, 1, 1, 1, 2007)));
13 tests/Date_Holidays_Driver_AustraliaNSW_TestSuite.php
@@ -12,11 +12,9 @@
12 12 * @link http://pear.php.net/package/Date_Holidays
13 13 * @see http://australia.gov.au/topics/australian-facts-and-figures/public-holidays
14 14 */
15   -if (!defined("PHPUnit_MAIN_METHOD")) {
16   - define("PHPUnit_MAIN_METHOD", "Date_HolidaysTest::main");
17   -}
18 15
19   -require_once 'Date/Holidays.php';
  16 +/** Set up the environment */
  17 +require_once dirname(__FILE__) . '/helper.inc';
20 18
21 19 /**
22 20 * Test class for running unit tests related to the driver for holidays in Austria
@@ -58,16 +56,13 @@ public function testHolidays($name, $year, $dateInfo)
58 56 {
59 57 $dh = new Date_Holidays();
60 58 $drv = $dh->factory('AustraliaNSW', $year, 'en_EN');
61   - $this->assertFalse(Date_Holidays::isError($drv));
62 59 if (Date_Holidays::isError($drv)) {
63   - print_r($drv);
64   - die($drv->getMessage());
  60 + $this->fail(helper_get_error_message($drv));
65 61 }
66 62
67 63 $day = $drv->getHoliday($name);
68   - $this->assertFalse(Date_Holidays::isError($day));
69 64 if (Date_Holidays::isError($day)) {
70   - die($day->getMessage());
  65 + $this->fail(helper_get_error_message($day));
71 66 }
72 67 $this->assertEquals($name, $day->getInternalName());
73 68 $date = $day->getDate();
15 tests/Date_Holidays_Driver_AustraliaQLD_TestSuite.php
@@ -12,11 +12,9 @@
12 12 * @link http://pear.php.net/package/Date_Holidays
13 13 * @see http://australia.gov.au/topics/australian-facts-and-figures/public-holidays
14 14 */
15   -if (!defined("PHPUnit_MAIN_METHOD")) {
16   - define("PHPUnit_MAIN_METHOD", "Date_HolidaysTest::main");
17   -}
18 15
19   -require_once 'Date/Holidays.php';
  16 +/** Set up the environment */
  17 +require_once dirname(__FILE__) . '/helper.inc';
20 18
21 19 /**
22 20 * Test class for running unit tests related to the driver for holidays in Queensland
@@ -83,16 +81,13 @@ public function testHolidays($name, $year, $dateInfo)
83 81 {
84 82 $dh = new Date_Holidays();
85 83 $drv = $dh->factory('AustraliaQLD', $year, 'en_EN');
86   - $this->assertFalse(Date_Holidays::isError($drv));
87 84 if (Date_Holidays::isError($drv)) {
88   - print_r($drv);
89   - die($drv->getMessage());
  85 + $this->fail(helper_get_error_message($drv));
90 86 }
91 87
92 88 $day = $drv->getHoliday($name);
93   - $this->assertFalse(Date_Holidays::isError($day));
94 89 if (Date_Holidays::isError($day)) {
95   - die($day->getMessage());
  90 + $this->fail(helper_get_error_message($day));
96 91 }
97 92 $this->assertEquals($name, $day->getInternalName());
98 93 $date = $day->getDate();
@@ -102,4 +97,4 @@ public function testHolidays($name, $year, $dateInfo)
102 97 }
103 98
104 99
105   -}
  100 +}
15 tests/Date_Holidays_Driver_AustraliaSA_TestSuite.php
@@ -12,11 +12,9 @@
12 12 * @link http://pear.php.net/package/Date_Holidays
13 13 * @see http://australia.gov.au/topics/australian-facts-and-figures/public-holidays
14 14 */
15   -if (!defined("PHPUnit_MAIN_METHOD")) {
16   - define("PHPUnit_MAIN_METHOD", "Date_HolidaysTest::main");
17   -}
18 15
19   -require_once 'Date/Holidays.php';
  16 +/** Set up the environment */
  17 +require_once dirname(__FILE__) . '/helper.inc';
20 18
21 19 /**
22 20 * Test class for running unit tests related to the driver for holidays in Austria
@@ -67,16 +65,13 @@ public function testHolidays($name, $year, $dateInfo)
67 65 {
68 66 $dh = new Date_Holidays();
69 67 $drv = $dh->factory('AustraliaSA', $year, 'en_EN');
70   - $this->assertFalse(Date_Holidays::isError($drv));
71 68 if (Date_Holidays::isError($drv)) {
72   - print_r($drv);
73   - die($drv->getMessage());
  69 + $this->fail(helper_get_error_message($drv));
74 70 }
75 71
76 72 $day = $drv->getHoliday($name);
77   - $this->assertFalse(Date_Holidays::isError($day));
78 73 if (Date_Holidays::isError($day)) {
79   - die($day->getMessage());
  74 + $this->fail(helper_get_error_message($day));
80 75 }
81 76 $this->assertEquals($name, $day->getInternalName());
82 77 $date = $day->getDate();
@@ -86,4 +81,4 @@ public function testHolidays($name, $year, $dateInfo)
86 81 }
87 82
88 83
89   -}
  84 +}
13 tests/Date_Holidays_Driver_AustraliaWA_TestSuite.php
@@ -11,11 +11,9 @@
11 11 * @version CVS: $Id: Date_Holidays_Driver_Austria_TestSuite.php 265332 2008-08-23 09:12:59Z kguest $
12 12 * @link http://pear.php.net/package/Date_Holidays
13 13 */
14   -if (!defined("PHPUnit_MAIN_METHOD")) {
15   - define("PHPUnit_MAIN_METHOD", "Date_HolidaysTest::main");
16   -}
17 14
18   -require_once 'Date/Holidays.php';
  15 +/** Set up the environment */
  16 +require_once dirname(__FILE__) . '/helper.inc';
19 17
20 18 /**
21 19 * Test class for running unit tests related to the driver for holidays Western Australia
@@ -80,16 +78,13 @@ public function testHolidays($name, $year, $dateInfo)
80 78 {
81 79 $dh = new Date_Holidays();
82 80 $drv = $dh->factory('AustraliaWA', $year, 'en_EN');
83   - $this->assertFalse(Date_Holidays::isError($drv));
84 81 if (Date_Holidays::isError($drv)) {
85   - print_r($drv);
86   - die($drv->getMessage());
  82 + $this->fail(helper_get_error_message($drv));
87 83 }
88 84
89 85 $day = $drv->getHoliday($name);
90   - $this->assertFalse(Date_Holidays::isError($day));
91 86 if (Date_Holidays::isError($day)) {
92   - die($day->getMessage());
  87 + $this->fail(helper_get_error_message($day));
93 88 }
94 89 $this->assertEquals($name, $day->getInternalName());
95 90 $date = $day->getDate();
15 tests/Date_Holidays_Driver_Australia_TestSuite.php
@@ -11,11 +11,9 @@
11 11 * @version CVS: $Id: Date_Holidays_Driver_Austria_TestSuite.php 265332 2008-08-23 09:12:59Z kguest $
12 12 * @link http://pear.php.net/package/Date_Holidays
13 13 */
14   -if (!defined("PHPUnit_MAIN_METHOD")) {
15   - define("PHPUnit_MAIN_METHOD", "Date_HolidaysTest::main");
16   -}
17 14
18   -require_once 'Date/Holidays.php';
  15 +/** Set up the environment */
  16 +require_once dirname(__FILE__) . '/helper.inc';
19 17
20 18 /**
21 19 * Test class for running unit tests related to the driver for holidays in Austria
@@ -80,16 +78,13 @@ public function testHolidays($name, $year, $dateInfo)
80 78 {
81 79 $dh = new Date_Holidays();
82 80 $drv = $dh->factory('Australia', $year, 'en_EN');
83   - $this->assertFalse(Date_Holidays::isError($drv));
84 81 if (Date_Holidays::isError($drv)) {
85   - print_r($drv);
86   - die($drv->getMessage());
  82 + $this->fail(helper_get_error_message($drv));
87 83 }
88 84
89 85 $day = $drv->getHoliday($name);
90   - $this->assertFalse(Date_Holidays::isError($day));
91 86 if (Date_Holidays::isError($day)) {
92   - die($day->getMessage());
  87 + $this->fail(helper_get_error_message($day));
93 88 }
94 89 $this->assertEquals($name, $day->getInternalName());
95 90 $date = $day->getDate();
@@ -99,4 +94,4 @@ public function testHolidays($name, $year, $dateInfo)
99 94 }
100 95
101 96
102   -}
  97 +}
20 tests/Date_Holidays_Driver_Austria_TestSuite.php
@@ -11,11 +11,9 @@
11 11 * @version CVS: $Id$
12 12 * @link http://pear.php.net/package/Date_Holidays
13 13 */
14   -if (!defined("PHPUnit_MAIN_METHOD")) {
15   - define("PHPUnit_MAIN_METHOD", "Date_HolidaysTest::main");
16   -}
17 14
18   -require_once 'Date/Holidays.php';
  15 +/** Set up the environment */
  16 +require_once dirname(__FILE__) . '/helper.inc';
19 17
20 18 /**
21 19 * Test class for running unit tests related to the driver for holidays in Austria
@@ -121,17 +119,14 @@ function setUp()
121 119 function testHolidays2007()
122 120 {
123 121 $drv = Date_Holidays::factory('Austria', 2007, 'en_EN');
124   - $this->assertFalse(Date_Holidays::isError($drv));
125 122 if (Date_Holidays::isError($drv)) {
126   - print_r($drv);
127   - die($drv->getMessage());
  123 + $this->fail(helper_get_error_message($drv));
128 124 }
129 125
130 126 foreach ($this->testDates2007 as $name => $dateInfo) {
131 127 $day = $drv->getHoliday($name);
132   - $this->assertFalse(Date_Holidays::isError($day));
133 128 if (Date_Holidays::isError($day)) {
134   - die($day->getMessage());
  129 + $this->fail(helper_get_error_message($day));
135 130 }
136 131 $this->assertEquals($name, $day->getInternalName());
137 132 $date = $day->getDate();
@@ -150,17 +145,14 @@ function testHolidays2007()
150 145 function testHolidays2006()
151 146 {
152 147 $drv = Date_Holidays::factory('Austria', 2006, 'en_EN');
153   - $this->assertFalse(Date_Holidays::isError($drv));
154 148 if (Date_Holidays::isError($drv)) {
155   - print_r($drv);
156   - die($drv->getMessage());
  149 + $this->fail(helper_get_error_message($drv));
157 150 }
158 151
159 152 foreach ($this->testDates2006 as $name => $dateInfo) {
160 153 $day = $drv->getHoliday($name);
161   - $this->assertFalse(Date_Holidays::isError($day));
162 154 if (Date_Holidays::isError($day)) {
163   - die($day->getMessage());
  155 + $this->fail(helper_get_error_message($day));
164 156 }
165 157 $this->assertEquals($name, $day->getInternalName());
166 158 $date = $day->getDate();
13 tests/Date_Holidays_Driver_Brazil_TestSuite.php
@@ -11,11 +11,9 @@
11 11 * @version CVS: $Id$
12 12 * @link http://pear.php.net/package/Date_Holidays
13 13 */
14   -if (!defined("PHPUnit_MAIN_METHOD")) {
15   - define("PHPUnit_MAIN_METHOD", "Date_HolidaysTest::main");
16   -}
17 14
18   -require_once 'Date/Holidays.php';
  15 +/** Set up the environment */
  16 +require_once dirname(__FILE__) . '/helper.inc';
19 17
20 18 /**
21 19 * Test class for running unit tests related to the driver for holidays in Brazil
@@ -110,17 +108,14 @@ function setUp()
110 108 function testHolidays2008()
111 109 {
112 110 $drv = Date_Holidays::factory('Brazil', 2008, 'en_EN');
113   - $this->assertFalse(Date_Holidays::isError($drv));
114 111 if (Date_Holidays::isError($drv)) {
115   - print_r($drv);
116   - die($drv->getMessage());
  112 + $this->fail(helper_get_error_message($drv));
117 113 }
118 114
119 115 foreach ($this->testDates2008 as $name => $dateInfo) {
120 116 $day = $drv->getHoliday($name);
121   - $this->assertFalse(Date_Holidays::isError($day));
122 117 if (Date_Holidays::isError($day)) {
123   - die($day->getMessage());
  118 + $this->fail(helper_get_error_message($day));
124 119 }
125 120 $this->assertEquals($name, $day->getInternalName());
126 121 $date = $day->getDate();
20 tests/Date_Holidays_Driver_Christian_TestSuite.php
@@ -12,11 +12,9 @@
12 12 * @version CVS: $Id$
13 13 * @link http://pear.php.net/package/Date_Holidays
14 14 */
15   -if (!defined("PHPUnit_MAIN_METHOD")) {
16   - define("PHPUnit_MAIN_METHOD", "Date_HolidaysTest::main");
17   -}
18 15
19   -require_once 'Date/Holidays.php';
  16 +/** Set up the environment */
  17 +require_once dirname(__FILE__) . '/helper.inc';
20 18
21 19 /**
22 20 * Test class for running unit tests related to Christian holidays.
@@ -106,18 +104,15 @@ function testHolidays2005()
106 104 {
107 105
108 106 $drvChristian = Date_Holidays::factory('Christian', 2005, 'en_EN');
109   - $this->assertFalse(Date_Holidays::isError($drvChristian));
110 107 if (Date_Holidays::isError($drvChristian)) {
111   - print_r($drvChristian);
112   - die($drvChristian->getMessage());
  108 + $this->fail(helper_get_error_message($drvChristian));
113 109 }
114 110
115 111
116 112 foreach ($this->testDates2005 as $name => $dateInfo) {
117 113 $day = $drvChristian->getHoliday($name);
118   - $this->assertFalse(Date_Holidays::isError($day));
119 114 if (Date_Holidays::isError($day)) {
120   - die($day->getMessage());
  115 + $this->fail(helper_get_error_message($day));
121 116 }
122 117 $this->assertEquals($name, $day->getInternalName());
123 118 $date = $day->getDate();
@@ -137,18 +132,15 @@ function testHolidays2006()
137 132 {
138 133
139 134 $drvChristian = Date_Holidays::factory('Christian', 2006, 'en_EN');
140   - $this->assertFalse(Date_Holidays::isError($drvChristian));
141 135 if (Date_Holidays::isError($drvChristian)) {
142   - print_r($drvChristian);
143   - die($drvChristian->getMessage());
  136 + $this->fail(helper_get_error_message($drvChristian));
144 137 }
145 138
146 139
147 140 foreach ($this->testDates2006 as $name => $dateInfo) {
148 141 $day = $drvChristian->getHoliday($name);
149   - $this->assertFalse(Date_Holidays::isError($day));
150 142 if (Date_Holidays::isError($day)) {
151   - die($day->getMessage());
  143 + $this->fail(helper_get_error_message($day));
152 144 }
153 145 $this->assertEquals($name, $day->getInternalName());
154 146 $date = $day->getDate();
6 tests/Date_Holidays_Driver_Denmark_TestSuite.php
@@ -11,11 +11,9 @@
11 11 * @version CVS: $Id$
12 12 * @link http://pear.php.net/package/Date_Holidays
13 13 */
14   -if (!defined("PHPUnit_MAIN_METHOD")) {
15   - define("PHPUnit_MAIN_METHOD", "Date_HolidaysTest::main");
16   -}
17 14
18   -require_once 'Date/Holidays.php';
  15 +/** Set up the environment */
  16 +require_once dirname(__FILE__) . '/helper.inc';
19 17
20 18 /**
21 19 * Test class for running unit tests related to the driver for holidays in Denmark
6 tests/Date_Holidays_Driver_Discordian_TestSuite.php
@@ -11,11 +11,9 @@
11 11 * @version CVS: $Id$
12 12 * @link http://pear.php.net/package/Date_Holidays
13 13 */
14   -if (!defined("PHPUnit_MAIN_METHOD")) {
15   - define("PHPUnit_MAIN_METHOD", "Date_HolidaysTest::main");
16   -}
17 14
18   -require_once 'Date/Holidays.php';
  15 +/** Set up the environment */
  16 +require_once dirname(__FILE__) . '/helper.inc';
19 17
20 18 /**
21 19 * Test class for running unit tests related to the driver for holidays in Discordian
10 tests/Date_Holidays_Driver_EnglandWales_TestSuite.php
@@ -12,11 +12,9 @@
12 12 * @version CVS: $Id$
13 13 * @link http://pear.php.net/package/Date_Holidays
14 14 */
15   -if (!defined("PHPUnit_MAIN_METHOD")) {
16   - define("PHPUnit_MAIN_METHOD", "Date_HolidaysTest::main");
17   -}
18 15
19   -require_once 'Date/Holidays.php';
  16 +/** Set up the environment */
  17 +require_once dirname(__FILE__) . '/helper.inc';
20 18
21 19 /**
22 20 * Test class for running unit tests related to the driver for holidays in
@@ -111,10 +109,8 @@ function setUp()
111 109 function testHolidays2009()
112 110 {
113 111 $drv = Date_Holidays::factory('EnglandWales', 2009, 'en_EN');
114   - $this->assertFalse(Date_Holidays::isError($drv));
115 112 if (Date_Holidays::isError($drv)) {
116   - print_r($drv);
117   - die($drv->getMessage());
  113 + $this->fail(helper_get_error_message($drv));
118 114 }
119 115 foreach ($this->testDates2009 as $name => $dateInfo) {
120 116 $day = $drv->getHoliday($name);
21 tests/Date_Holidays_Driver_Finland_TestSuite.php
@@ -11,13 +11,9 @@
11 11 * @version CVS: $Id: Date_Holidays_Driver_Finland_TestSuite.php 310677 2011-04-30 22:27:19Z kguest $
12 12 * @link http://pear.php.net/package/Date_Holidays
13 13 */
14   -if (!defined("PHPUnit_MAIN_METHOD")) {
15   - define("PHPUnit_MAIN_METHOD", "Date_HolidaysTest::main");
16   -}
17   -
18   -require_once 'Date/Holidays.php';
19 14
20   -define('LANG_FILE', '@DATA-DIR@/Date_Holidays_Finland/lang/');
  15 +/** Set up the environment */
  16 +require_once dirname(__FILE__) . '/helper.inc';
21 17
22 18 /**
23 19 * Test class for running unit tests related to the driver for holidays in Finland
@@ -154,16 +150,14 @@ function setUp()
154 150 function testHolidays2005()
155 151 {
156 152 $drv = Date_Holidays::factory('Finland', 2005, 'en_EN');
157   - $this->assertFalse(Date_Holidays::isError($drv));
158 153 if (Date_Holidays::isError($drv)) {
159   - $this->fail($drv->getMessage());
  154 + $this->fail(helper_get_error_message($drv));
160 155 }
161 156
162 157 foreach ($this->testDates2005 as $name => $dateInfo) {
163 158 $day = $drv->getHoliday($name);
164   - $this->assertFalse(Date_Holidays::isError($day));
165 159 if (Date_Holidays::isError($day)) {
166   - die($day->getMessage());
  160 + $this->fail(helper_get_error_message($day));
167 161 }
168 162 $this->assertEquals($name, $day->getInternalName());
169 163 $date = $day->getDate();
@@ -182,17 +176,14 @@ function testHolidays2005()
182 176 function testHolidays2006()
183 177 {
184 178 $drv = Date_Holidays::factory('Finland', 2006, 'en_EN');
185   - $this->assertFalse(Date_Holidays::isError($drv));
186 179 if (Date_Holidays::isError($drv)) {
187   - print_r($drv);
188   - die($drv->getMessage());
  180 + $this->fail(helper_get_error_message($drv));
189 181 }
190 182
191 183 foreach ($this->testDates2006 as $name => $dateInfo) {
192 184 $day = $drv->getHoliday($name);
193   - $this->assertFalse(Date_Holidays::isError($day));
194 185 if (Date_Holidays::isError($day)) {
195   - die($day->getMessage());
  186 + $this->fail(helper_get_error_message($day));
196 187 }
197 188 $this->assertEquals($name, $day->getInternalName());
198 189 $date = $day->getDate();
24 tests/Date_Holidays_Driver_Germany_TestSuite.php
@@ -11,11 +11,9 @@
11 11 * @version CVS: $Id$
12 12 * @link http://pear.php.net/package/Date_Holidays
13 13 */
14   -if (!defined("PHPUnit_MAIN_METHOD")) {
15   - define("PHPUnit_MAIN_METHOD", "Date_HolidaysTest::main");
16   -}
17 14
18   -require_once 'Date/Holidays.php';
  15 +/** Set up the environment */
  16 +require_once dirname(__FILE__) . '/helper.inc';
19 17
20 18 /**
21 19 * Test class for running unit tests related to the driver for holidays in Austria
@@ -172,19 +170,15 @@ function setUp()
172 170 function testHolidays2005()
173 171 {
174 172 $drv = Date_Holidays::factory('Germany', 2005, 'en_EN');
175   - $this->assertFalse(Date_Holidays::isError($drv));
176 173 if (Date_Holidays::isError($drv)) {
177   - print_r($drv);
178   - die($drv->getMessage());
  174 + $this->fail(helper_get_error_message($drv));
179 175 }
180 176
181 177
182 178 foreach ($this->testDates2005 as $name => $dateInfo) {
183 179 $day = $drv->getHoliday($name);
184   -
185   - $this->assertFalse(Date_Holidays::isError($day));
186 180 if (Date_Holidays::isError($day)) {
187   - die($day->getMessage());
  181 + $this->fail(helper_get_error_message($day));
188 182 }
189 183 $this->assertEquals($name, $day->getInternalName());
190 184 $date = $day->getDate();
@@ -204,18 +198,15 @@ function testHolidays2005()
204 198 function testHolidays2006()
205 199 {
206 200 $drv = Date_Holidays::factory('Germany', 2006, 'en_EN');
207   - $this->assertFalse(Date_Holidays::isError($drv));
208 201 if (Date_Holidays::isError($drv)) {
209   - print_r($drv);
210   - die($drv->getMessage());
  202 + $this->fail(helper_get_error_message($drv));
211 203 }
212 204
213 205
214 206 foreach ($this->testDates2006 as $name => $dateInfo) {
215 207 $day = $drv->getHoliday($name);
216   - $this->assertFalse(Date_Holidays::isError($day));
217 208 if (Date_Holidays::isError($day)) {
218   - die($day->getMessage());
  209 + $this->fail(helper_get_error_message($day));
219 210 }
220 211 $this->assertEquals($name, $day->getInternalName());
221 212 $date = $day->getDate();
@@ -234,9 +225,8 @@ function testHolidays2006()
234 225 function testHolidays2005stampsAndSavingsDay()
235 226 {
236 227 $drv = Date_Holidays::factory('Germany', 2005);
237   - $this->assertFalse(Date_Holidays::isError($drv));
238 228 if (Date_Holidays::isError($drv)) {
239   - die($drv->getMessage());
  229 + $this->fail(helper_get_error_message($drv));
240 230 }
241 231 $holidays = $drv->getHolidayForDate('2005-10-30', null, true);
242 232 $this->assertEquals('savingsDay',
6 tests/Date_Holidays_Driver_Iceland_TestSuite.php
@@ -11,11 +11,9 @@
11 11 * @version CVS: $Id$
12 12 * @link http://pear.php.net/package/Date_Holidays
13 13 */
14   -if (!defined("PHPUnit_MAIN_METHOD")) {
15   - define("PHPUnit_MAIN_METHOD", "Date_HolidaysTest::main");
16   -}
17 14
18   -require_once 'Date/Holidays.php';
  15 +/** Set up the environment */
  16 +require_once dirname(__FILE__) . '/helper.inc';
19 17
20 18 /**
21 19 * Test class for running unit tests related to the driver for holidays in Austria
6 tests/Date_Holidays_Driver_Ireland_TestSuite.php
@@ -11,11 +11,9 @@
11 11 * @version CVS: $Id$
12 12 * @link http://pear.php.net/package/Date_Holidays
13 13 */
14   -if (!defined("PHPUnit_MAIN_METHOD")) {
15   - define("PHPUnit_MAIN_METHOD", "Date_HolidaysTest::main");
16   -}
17 14
18   -require_once 'Date/Holidays.php';
  15 +/** Set up the environment */
  16 +require_once dirname(__FILE__) . '/helper.inc';
19 17
20 18 /**
21 19 * Test class for running unit tests related to the driver for holidays in Ireland
6 tests/Date_Holidays_Driver_Italy_TestSuite.php
@@ -12,11 +12,9 @@
12 12 * @version CVS: $Id$
13 13 * @link http://pear.php.net/package/Date_Holidays
14 14 */
15   -if (!defined("PHPUnit_MAIN_METHOD")) {
16   - define("PHPUnit_MAIN_METHOD", "Date_HolidaysTest::main");
17   -}
18 15
19   -require_once 'Date/Holidays.php';
  16 +/** Set up the environment */
  17 +require_once dirname(__FILE__) . '/helper.inc';
20 18
21 19 /**
22 20 * Test class for running unit tests related to the driver for holidays in Italy
50 tests/Date_Holidays_Driver_Japan_TestSuite.php
@@ -12,13 +12,9 @@
12 12 * @version CVS: $Id$
13 13 * @link http://pear.php.net/package/Date_Holidays
14 14 */
15   -if (!defined("PHPUnit_MAIN_METHOD")) {
16   - define("PHPUnit_MAIN_METHOD", "Date_HolidaysTest::main");
17   -}
18   -
19   -require_once 'Date/Holidays.php';
20 15
21   -define('LANG_FILE', '/usr/local/lib/php5/pear/data/Date_Holidays_Japan/lang/');
  16 +/** Set up the environment */
  17 +require_once dirname(__FILE__) . '/helper.inc';
22 18
23 19 /**
24 20 * Test class for running unit tests related to the driver for holidays
@@ -35,6 +31,7 @@
35 31 class Date_Holidays_Driver_Japan_TestSuite extends PHPUnit_Framework_TestCase
36 32 {
37 33 var $_holidays;
  34 + protected $lang_dir;
38 35
39 36 /**
40 37 * setUp
@@ -44,6 +41,7 @@ class Date_Holidays_Driver_Japan_TestSuite extends PHPUnit_Framework_TestCase
44 41 */
45 42 function setUp()
46 43 {
  44 + $this->lang_dir = helper_get_lang_dir('Date_Holidays_Japan');
47 45 $this->_holidays = array(
48 46 '1970-01-01' => true,
49 47 '1970-01-15' => true,
@@ -1343,7 +1341,7 @@ function testHolidaysFrom1970to2050()
1343 1341 for ($year = 1970; $year < 2051; $year++) {
1344 1342 $obj =& Date_Holidays::factory('Japan', $year);
1345 1343 if (Date_Holidays::isError($obj)) {
1346   - $this->fail('Factory was unable to produce driver-object');
  1344 + $this->fail(helper_get_error_message($obj));
1347 1345 }
1348 1346
1349 1347 $invalid_holidays = array();
@@ -1373,7 +1371,7 @@ function testSubstituteHolidaysInMay2008()
1373 1371 {
1374 1372 $obj = Date_Holidays::factory('Japan', 2008);
1375 1373 if (Date_Holidays::isError($obj)) {
1376   - $this->fail('Factory was unable to produce driver-object');
  1374 + $this->fail(helper_get_error_message($obj));
1377 1375 }
1378 1376 // calculate substitute holiday for Children's Day (1st time)
1379 1377 $this->assertTrue($obj->isHoliday(new Date('2008-05-06')), '1st time');
@@ -1397,9 +1395,9 @@ function testSetYearWithXmlTranslationFile()
1397 1395 // with ja_JP.xml
1398 1396 $obj = Date_Holidays::factory('Japan', 2008);
1399 1397 if (Date_Holidays::isError($obj)) {
1400   - $this->fail('Factory was unable to produce driver-object');
  1398 + $this->fail(helper_get_error_message($obj));
1401 1399 }
1402   - $obj->addTranslationFile(LANG_FILE . '/Japan/ja_JP.xml', 'ja_JP');
  1400 + $obj->addTranslationFile($this->lang_dir . '/Japan/ja_JP.xml', 'ja_JP');
1403 1401 if (Date_Holidays::isError($obj)) {
1404 1402 $this->fail('fail to add translation file');
1405 1403 }
@@ -1424,9 +1422,9 @@ function testSetYearWithCompiledTranslationFile()
1424 1422 // with ja_JP.ser
1425 1423 $obj = Date_Holidays::factory('Japan', 2008);
1426 1424 if (Date_Holidays::isError($obj)) {
1427   - $this->fail('Factory was unable to produce driver-object');
  1425 + $this->fail(helper_get_error_message($obj));
1428 1426 }
1429   - $obj->addCompiledTranslationFile(LANG_FILE . '/Japan/ja_JP.ser', 'ja_JP');
  1427 + $obj->addCompiledTranslationFile($this->lang_dir . '/Japan/ja_JP.ser', 'ja_JP');
1430 1428 if (Date_Holidays::isError($obj)) {
1431 1429 $this->fail('fail to add translation file');
1432 1430 }
@@ -1451,7 +1449,7 @@ function testHolidaysFrom1970to2050WithSetYear()
1451 1449 {
1452 1450 $obj =& Date_Holidays::factory('Japan');
1453 1451 if (Date_Holidays::isError($obj)) {
1454   - $this->fail('Factory was unable to produce driver-object');
  1452 + $this->fail(helper_get_error_message($obj));
1455 1453 }
1456 1454 for ($year = 1970; $year < 2051; $year++) {
1457 1455 $obj->setYear($year);
@@ -1483,9 +1481,9 @@ function testShowaDay()
1483 1481 // with ja_JP.xml
1484 1482 $obj = Date_Holidays::factory('Japan', 1949);
1485 1483 if (Date_Holidays::isError($obj)) {
1486   - $this->fail('Factory was unable to produce driver-object');
  1484 + $this->fail(helper_get_error_message($obj));
1487 1485 }
1488   - $obj->addTranslationFile(LANG_FILE . '/Japan/ja_JP.xml', 'ja_JP');
  1486 + $obj->addTranslationFile($this->lang_dir . '/Japan/ja_JP.xml', 'ja_JP');
1489 1487 if (Date_Holidays::isError($obj)) {
1490 1488 $this->fail('fail to add translation file');
1491 1489 }
@@ -1510,9 +1508,9 @@ function testShowaDayWithCompiledTranslationFile()
1510 1508 // with ja_JP.ser
1511 1509 $obj = Date_Holidays::factory('Japan', 1949);
1512 1510 if (Date_Holidays::isError($obj)) {
1513   - $this->fail('Factory was unable to produce driver-object');
  1511 + $this->fail(helper_get_error_message($obj));
1514 1512 }
1515   - $obj->addCompiledTranslationFile(LANG_FILE . '/Japan/ja_JP.ser', 'ja_JP');
  1513 + $obj->addCompiledTranslationFile($this->lang_dir . '/Japan/ja_JP.ser', 'ja_JP');
1516 1514 if (Date_Holidays::isError($obj)) {
1517 1515 $this->fail('fail to add translation file');
1518 1516 }
@@ -1537,9 +1535,9 @@ function testGreeneyDay()
1537 1535 // with ja_JP.xml
1538 1536 $obj = Date_Holidays::factory('Japan', 1986);
1539 1537 if (Date_Holidays::isError($obj)) {
1540   - $this->fail('Factory was unable to produce driver-object');
  1538 + $this->fail(helper_get_error_message($obj));
1541 1539 }
1542   - $obj->addTranslationFile(LANG_FILE . '/Japan/ja_JP.xml', 'ja_JP');
  1540 + $obj->addTranslationFile($this->lang_dir . '/Japan/ja_JP.xml', 'ja_JP');
1543 1541 if (Date_Holidays::isError($obj)) {
1544 1542 $this->fail('fail to add translation file');
1545 1543 }
@@ -1565,9 +1563,9 @@ function testGreeneyDayWithCompiledTranslationFile()
1565 1563 // with ja_JP.ser
1566 1564 $obj = Date_Holidays::factory('Japan', 1986);
1567 1565 if (Date_Holidays::isError($obj)) {
1568   - $this->fail('Factory was unable to produce driver-object');
  1566 + $this->fail(helper_get_error_message($obj));
1569 1567 }
1570   - $obj->addCompiledTranslationFile(LANG_FILE . '/Japan/ja_JP.ser', 'ja_JP');
  1568 + $obj->addCompiledTranslationFile($this->lang_dir . '/Japan/ja_JP.ser', 'ja_JP');
1571 1569 if (Date_Holidays::isError($obj)) {
1572 1570 $this->fail('fail to add translation file');
1573 1571 }
@@ -1593,16 +1591,16 @@ function test16338()
1593 1591 for ($year = 1900; $year < date('Y'); $year++) {
1594 1592 $obj = Date_Holidays::factory('Japan', $year, 'ja_JP');
1595 1593 if (Date_Holidays::isError($obj)) {
1596   - $this->fail('Factory was unable to produce driver-object');
  1594 + $this->fail(helper_get_error_message($obj));
1597 1595 }
1598   - $obj->addTranslationFile(LANG_FILE . '/Japan/ja_JP.xml', 'ja_JP');
1599   - if (Date_Holidays::isError($obj)) {
1600   - $this->fail('fail to add translation file');
  1596 + $res = $obj->addTranslationFile($this->lang_dir . '/Japan/ja_JP.xml', 'ja_JP');
  1597 + if (Date_Holidays::isError($res)) {
  1598 + $this->fail(helper_get_error_message($res));
1601 1599 }
1602 1600 $holidays = array();
1603 1601 foreach ($obj->getHolidays() as $h) {
1604 1602 if (PEAR::isError($h)) {
1605   - $this->fail('test failed');
  1603 + $this->fail(helper_get_error_message($h));
1606 1604 }
1607 1605 $holidays[$h->getDate()->format('%Y-%m-%d')] = $h->getTitle();
1608 1606 }
6 tests/Date_Holidays_Driver_Jewish_TestSuite.php
@@ -11,11 +11,9 @@
11 11 * @version CVS: $Id$
12 12 * @link http://pear.php.net/package/Date_Holidays
13 13 */
14   -if (!defined("PHPUnit_MAIN_METHOD")) {
15   - define("PHPUnit_MAIN_METHOD", "Date_HolidaysTest::main");
16   -}
17 14
18   -require_once 'Date/Holidays.php';
  15 +/** Set up the environment */
  16 +require_once dirname(__FILE__) . '/helper.inc';
19 17
20 18 /**
21 19 * Test class for running unit tests related to the driver for Jewish Holidays
6 tests/Date_Holidays_Driver_Netherlands_TestSuite.php
@@ -11,11 +11,9 @@
11 11 * @version CVS: $Id$
12 12 * @link http://pear.php.net/package/Date_Holidays
13 13 */
14   -if (!defined("PHPUnit_MAIN_METHOD")) {
15   - define("PHPUnit_MAIN_METHOD", "Date_HolidaysTest::main");
16   -}
17 14
18   -require_once 'Date/Holidays.php';
  15 +/** Set up the environment */
  16 +require_once dirname(__FILE__) . '/helper.inc';
19 17
20 18 /**
21 19 * Test class for running unit tests related to the driver for holidays in Netherlands
6 tests/Date_Holidays_Driver_Norway_TestSuite.php
@@ -11,11 +11,9 @@
11 11 * @version CVS: $Id$
12 12 * @link http://pear.php.net/package/Date_Holidays
13 13 */
14   -if (!defined("PHPUnit_MAIN_METHOD")) {
15   - define("PHPUnit_MAIN_METHOD", "Date_HolidaysTest::main");
16   -}
17 14
18   -require_once 'Date/Holidays.php';
  15 +/** Set up the environment */
  16 +require_once dirname(__FILE__) . '/helper.inc';
19 17
20 18 /**
21 19 * Test class for running unit tests related to the driver for holidays in Norway
6 tests/Date_Holidays_Driver_PHPdotNet_TestSuite.php
@@ -11,11 +11,9 @@
11 11 * @version CVS: $Id$
12 12 * @link http://pear.php.net/package/Date_Holidays
13 13 */
14   -if (!defined("PHPUnit_MAIN_METHOD")) {
15   - define("PHPUnit_MAIN_METHOD", "Date_HolidaysTest::main");
16   -}
17 14
18   -require_once 'Date/Holidays.php';
  15 +/** Set up the environment */
  16 +require_once dirname(__FILE__) . '/helper.inc';
19 17
20 18 /**
21 19 * Test class for running unit tests related to the PHPdotNet driver.
13 tests/Date_Holidays_Driver_Portugal_TestSuite.php
@@ -11,11 +11,9 @@
11 11 * @version CVS: $Id: Date_Holidays_Driver_Austria_TestSuite.php 265332 2008-08-23 09:12:59Z kguest $
12 12 * @link http://pear.php.net/package/Date_Holidays
13 13 */
14   -if (!defined("PHPUnit_MAIN_METHOD")) {
15   - define("PHPUnit_MAIN_METHOD", "Date_HolidaysTest::main");
16   -}
17 14
18   -require_once 'Date/Holidays.php';
  15 +/** Set up the environment */
  16 +require_once dirname(__FILE__) . '/helper.inc';
19 17
20 18 /**
21 19 * Test class for running unit tests related to the driver for holidays in Austria
@@ -98,17 +96,14 @@ function setUp()
98 96 function testHolidays2009()
99 97 {
100 98 $drv = Date_Holidays::factory('Portugal', 2009, 'en_EN');
101   - $this->assertFalse(Date_Holidays::isError($drv));
102 99 if (Date_Holidays::isError($drv)) {
103   - print_r($drv);
104   - die($drv->getMessage());
  100 + $this->fail(helper_get_error_message($drv));
105 101 }
106 102
107 103 foreach ($this->testDates2009 as $name => $dateInfo) {
108 104 $day = $drv->getHoliday($name);
109   - $this->assertFalse(Date_Holidays::isError($day));
110 105 if (Date_Holidays::isError($day)) {
111   - die($day->getMessage());
  106 + $this->fail(helper_get_error_message($day));
112 107 }
113 108 $this->assertEquals($name, $day->getInternalName());
114 109 $date = $day->getDate();
21 tests/Date_Holidays_Driver_Romania_TestSuite.php
@@ -11,11 +11,9 @@
11 11 * @version CVS: $Id$
12 12 * @link http://pear.php.net/package/Date_Holidays
13 13 */
14   -if (!defined("PHPUnit_MAIN_METHOD")) {
15   - define("PHPUnit_MAIN_METHOD", "Date_HolidaysTest::main");
16   -}
17 14
18   -require_once 'Date/Holidays.php';
  15 +/** Set up the environment */
  16 +require_once dirname(__FILE__) . '/helper.inc';
19 17
20 18 /**
21 19 * Test class for running unit tests related to the driver for holidays in Austria
@@ -100,15 +98,15 @@ function setUp()
100 98 function testHolidays2007()
101 99 {
102 100 $drv = Date_Holidays::factory('Romania', 2007, 'en_EN');
103   - $this->assertFalse(Date_Holidays::isError($drv));
104 101 if (Date_Holidays::isError($drv)) {
105   - print_r($drv);
106   - die($drv->getMessage());
  102 + $this->fail(helper_get_error_message($drv));
107 103 }
108 104
109 105 foreach ($this->testDates2007 as $name => $dateInfo) {
110 106 $day = $drv->getHoliday($name);
111   - $this->assertFalse(Date_Holidays::isError($day), $name);
  107 + if (Date_Holidays::isError($day)) {
  108 + $this->fail(helper_get_error_message($day));
  109 + }
112 110 $this->assertEquals($name, $day->getInternalName(), $name);
113 111 $date = $day->getDate();
114 112 $this->assertEquals($dateInfo['day'], $date->getDay(), $name);
@@ -126,17 +124,14 @@ function testHolidays2007()
126 124 function testHolidays2006()
127 125 {
128 126 $drv = Date_Holidays::factory('Romania', 2006, 'en_EN');
129   - $this->assertFalse(Date_Holidays::isError($drv));
130 127 if (Date_Holidays::isError($drv)) {
131   - print_r($drv);
132   - die($drv->getMessage());
  128 + $this->fail(helper_get_error_message($drv));
133 129 }
134 130
135 131 foreach ($this->testDates2006 as $name => $dateInfo) {
136 132 $day = $drv->getHoliday($name);
137   - $this->assertFalse(Date_Holidays::isError($day));
138 133 if (Date_Holidays::isError($day)) {
139   - die($day->getMessage());
  134 + $this->fail(helper_get_error_message($day));
140 135 }
141 136 $this->assertEquals($name, $day->getInternalName());
142 137 $date = $day->getDate();
6 tests/Date_Holidays_Driver_Slovenia_TestSuite.php
@@ -11,11 +11,9 @@
11 11 * @version CVS: $Id$
12 12 * @link http://pear.php.net/package/Date_Holidays
13 13 */
14   -if (!defined("PHPUnit_MAIN_METHOD")) {
15   - define("PHPUnit_MAIN_METHOD", "Date_HolidaysTest::main");
16   -}
17 14
18   -require_once 'Date/Holidays.php';
  15 +/** Set up the environment */
  16 +require_once dirname(__FILE__) . '/helper.inc';
19 17
20 18 /**
21 19 * Test class for running unit tests related to the driver for holidays in Slovenia
13 tests/Date_Holidays_Driver_Spain_TestSuite.php
@@ -11,11 +11,9 @@
11 11 * @version CVS: $Id: Date_Holidays_Driver_Spain_TestSuite.php 265332 2008-08-23 09:12:59Z kguest $
12 12 * @link http://pear.php.net/package/Date_Holidays
13 13 */
14   -if (!defined("PHPUnit_MAIN_METHOD")) {
15   - define("PHPUnit_MAIN_METHOD", "Date_HolidaysTest::main");
16   -}
17 14
18   -require_once 'Date/Holidays.php';
  15 +/** Set up the environment */
  16 +require_once dirname(__FILE__) . '/helper.inc';
19 17
20 18 /**