<?php
/**
 * Test class for running unit tests related to the driver for holidays in Austria
 *
 * PHP Versions 4 and 5
 *
 * @category Date
 * @package  Date_Holidays
 * @author   Ken Guest <kguest@php.net>
 * @license  http://www.php.net/license/3_01.txt PHP License 3.0.1
 * @version  CVS: $Id: Date_Holidays_Driver_Romania_TestSuite.php,v 1.5 2008/08/23 08:42:26 kguest Exp $
 * @link     http://pear.php.net/package/Date_Holidays
 */
if (!defined("PHPUnit_MAIN_METHOD")) {
    define("PHPUnit_MAIN_METHOD", "Date_HolidaysTest::main");
}

require_once 'Date/Holidays.php';

/**
 * Test class for running unit tests related to the driver for holidays in Austria
 *
 * @uses PHPUnit_Framework_TestCase
 * @category Date
 * @package  Date_Holidays
 * @author   Ken Guest <kguest@php.net>
 * @license  http://www.php.net/license/3_01.txt PHP License 3.0.1
 * @version  CVS: $Id: Date_Holidays_Driver_Romania_TestSuite.php,v 1.5 2008/08/23 08:42:26 kguest Exp $
 * @link     http://pear.php.net/package/Date_Holidays
 */
class Date_Holidays_Driver_Romania_TestSuite extends PHPUnit_Framework_TestCase
{

    var $testDates2006;
    var $testDates2007;

    /**
     * setUp
     *
     * @access public
     * @return void
     */
    function setUp()
    {

        $this->testDates2006 = array(
            'newYearsDay'       => array('day' => 1,
                                          'month' => 1,
                                          'year' => 2006),
            'easter'            => array('day' => 23,
                                          'month' => 4,
                                          'year' => 2006),
            'easterMonday'            => array('day' => 24,
                                          'month' => 4,
                                          'year' => 2006),
            'labourDay'        => array('day' => 1,
                                          'month' => 5,
                                          'year' => 2006),
            'nationalDay'   => array('day' => 1,
                                          'month' => 12,
                                          'year' => 2006),
            'christmasEve'      => array('day' => 24,
                                          'month' => 12,
                                          'year' => 2006),
            'christmasDay'      => array('day' => 25,
                                          'month' => 12,
                                          'year' => 2006)
        );
        $this->testDates2007 = array(
            'newYearsDay'       => array('day' => 1,
                                          'month' => 1,
                                          'year' => 2007),
            'easter'            => array('day' => 8,
                                          'month' => 4,
                                          'year' => 2007),
            'easterMonday'            => array('day' => 9,
                                          'month' => 4,
                                          'year' => 2007),
            'labourDay'        => array('day' => 1,
                                          'month' => 5,
                                          'year' => 2007),
            'nationalDay'   => array('day' => 1,
                                          'month' => 12,
                                          'year' => 2007),
            'christmasEve'      => array('day' => 24,
                                          'month' => 12,
                                          'year' => 2007),
            'christmasDay'      => array('day' => 25,
                                          'month' => 12,
                                          'year' => 2007)
        );
    }

    /**
     * test Holidays for 2007
     *
     * @access public
     * @return void
     */
    function testHolidays2007()
    {
        $drv = Date_Holidays::factory('Romania', 2007, 'en_EN');
        $this->assertFalse(Date_Holidays::isError($drv));
        if (Date_Holidays::isError($drv)) {
            print_r($drv);
            die($drv->getMessage());
        }

        foreach ($this->testDates2007 as $name => $dateInfo) {
            $day = $drv->getHoliday($name);
            $this->assertFalse(Date_Holidays::isError($day), $name);
            $this->assertEquals($name, $day->getInternalName(), $name);
            $date = $day->getDate();
            $this->assertEquals($dateInfo['day'], $date->getDay(), $name);
            $this->assertEquals($dateInfo['month'], $date->getMonth(), $name);
            $this->assertEquals($dateInfo['year'], $date->getYear(), $name);
        }
    }

    /**
     * test Holidays for 2006
     *
     * @access public
     * @return void
     */
    function testHolidays2006()
    {
        $drv = Date_Holidays::factory('Romania', 2006, 'en_EN');
        $this->assertFalse(Date_Holidays::isError($drv));
        if (Date_Holidays::isError($drv)) {
            print_r($drv);
            die($drv->getMessage());
        }

        foreach ($this->testDates2006 as $name => $dateInfo) {
            $day = $drv->getHoliday($name);
            $this->assertFalse(Date_Holidays::isError($day));
            if (Date_Holidays::isError($day)) {
                die($day->getMessage());
            }
            $this->assertEquals($name, $day->getInternalName());
            $date = $day->getDate();
            $this->assertEquals($dateInfo['day'], $date->getDay(), $name);
            $this->assertEquals($dateInfo['month'], $date->getMonth(), $name);
            $this->assertEquals($dateInfo['year'], $date->getYear(), $name);
        }
    }

}

?>
