source: branches/comu-ver2/data/module/Calendar/tests/calendar_test.php @ 18701

Revision 18701, 3.4 KB checked in by nanasess, 14 years ago (diff)

Copyright の更新(#601)

Line 
1<?php
2// $Id: calendar_test.php,v 1.1 2004/05/24 22:25:43 quipo Exp $
3
4require_once('simple_include.php');
5require_once('calendar_include.php');
6
7class TestOfCalendar extends UnitTestCase {
8    var $cal;
9    function TestOfCalendar($name='Test of Calendar') {
10        $this->UnitTestCase($name);
11    }
12    function setUp() {
13        $this->cal = new Calendar(2003,10,25,13,32,43);
14    }
15    function tearDown() {
16        unset($this->cal);
17    }
18    function testPrevYear () {
19        $this->assertEqual(2002,$this->cal->prevYear());
20    }
21    function testPrevYear_Array () {
22        $this->assertEqual(
23            array(
24                'year'   => 2002,
25                'month'  => 1,
26                'day'    => 1,
27                'hour'   => 0,
28                'minute' => 0,
29                'second' => 0),
30            $this->cal->prevYear('array'));
31    }
32    function testThisYear () {
33        $this->assertEqual(2003,$this->cal->thisYear());
34    }
35    function testNextYear () {
36        $this->assertEqual(2004,$this->cal->nextYear());
37    }
38    function testPrevMonth () {
39        $this->assertEqual(9,$this->cal->prevMonth());
40    }
41    function testPrevMonth_Array () {
42        $this->assertEqual(
43            array(
44                'year'   => 2003,
45                'month'  => 9,
46                'day'    => 1,
47                'hour'   => 0,
48                'minute' => 0,
49                'second' => 0),
50            $this->cal->prevMonth('array'));
51    }
52    function testThisMonth () {
53        $this->assertEqual(10,$this->cal->thisMonth());
54    }
55    function testNextMonth () {
56        $this->assertEqual(11,$this->cal->nextMonth());
57    }
58    function testPrevDay () {
59        $this->assertEqual(24,$this->cal->prevDay());
60    }
61    function testPrevDay_Array () {
62        $this->assertEqual(
63            array(
64                'year'   => 2003,
65                'month'  => 10,
66                'day'    => 24,
67                'hour'   => 0,
68                'minute' => 0,
69                'second' => 0),
70            $this->cal->prevDay('array'));
71    }
72    function testThisDay () {
73        $this->assertEqual(25,$this->cal->thisDay());
74    }
75    function testNextDay () {
76        $this->assertEqual(26,$this->cal->nextDay());
77    }
78    function testPrevHour () {
79        $this->assertEqual(12,$this->cal->prevHour());
80    }
81    function testThisHour () {
82        $this->assertEqual(13,$this->cal->thisHour());
83    }
84    function testNextHour () {
85        $this->assertEqual(14,$this->cal->nextHour());
86    }
87    function testPrevMinute () {
88        $this->assertEqual(31,$this->cal->prevMinute());
89    }
90    function testThisMinute () {
91        $this->assertEqual(32,$this->cal->thisMinute());
92    }
93    function testNextMinute () {
94        $this->assertEqual(33,$this->cal->nextMinute());
95    }
96    function testPrevSecond () {
97        $this->assertEqual(42,$this->cal->prevSecond());
98    }
99    function testThisSecond () {
100        $this->assertEqual(43,$this->cal->thisSecond());
101    }
102    function testNextSecond () {
103        $this->assertEqual(44,$this->cal->nextSecond());
104    }
105    function testSetTimeStamp() {
106        $stamp = mktime(13,32,43,10,25,2003);
107        $this->cal->setTimeStamp($stamp);
108        $this->assertEqual($stamp,$this->cal->getTimeStamp());
109    }
110    function testGetTimeStamp() {
111        $stamp = mktime(13,32,43,10,25,2003);
112        $this->assertEqual($stamp,$this->cal->getTimeStamp());
113    }
114}
115?>
Note: See TracBrowser for help on using the repository browser.