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

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

Copyright の更新(#601)

Line 
1<?php
2// $Id: minute_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
7require_once('./calendar_test.php');
8
9class TestOfMinute extends TestOfCalendar {
10    function TestOfMinute() {
11        $this->UnitTestCase('Test of Minute');
12    }
13    function setUp() {
14        $this->cal = new Calendar_Minute(2003,10,25,13,32);
15    }
16    function testPrevDay_Array () {
17        $this->assertEqual(
18            array(
19                'year'   => 2003,
20                'month'  => 10,
21                'day'    => 24,
22                'hour'   => 0,
23                'minute' => 0,
24                'second' => 0),
25            $this->cal->prevDay('array'));
26    }
27    function testPrevSecond () {
28        $this->assertEqual(59,$this->cal->prevSecond());
29    }
30    function testThisSecond () {
31        $this->assertEqual(0,$this->cal->thisSecond());
32    }
33    function testThisSecond_Timestamp () {
34        $this->assertEqual($this->cal->cE->dateToStamp(
35                2003, 10, 25, 13, 32, 0),
36            $this->cal->thisSecond('timestamp'));
37    }
38    function testNextSecond () {
39        $this->assertEqual(1,$this->cal->nextSecond());
40    }
41    function testNextSecond_Timestamp () {
42        $this->assertEqual($this->cal->cE->dateToStamp(
43                2003, 10, 25, 13, 32, 1),
44            $this->cal->nextSecond('timestamp'));
45    }
46    function testGetTimeStamp() {
47        $stamp = mktime(13,32,0,10,25,2003);
48        $this->assertEqual($stamp,$this->cal->getTimeStamp());
49    }
50}
51
52class TestOfMinuteBuild extends TestOfMinute {
53    function TestOfMinuteBuild() {
54        $this->UnitTestCase('Test of Minute::build()');
55    }
56    function testSize() {
57        $this->cal->build();
58        $this->assertEqual(60,$this->cal->size());
59    }
60    function testFetch() {
61        $this->cal->build();
62        $i=0;
63        while ( $Child = $this->cal->fetch() ) {
64            $i++;
65        }
66        $this->assertEqual(60,$i);
67    }
68    function testFetchAll() {
69        $this->cal->build();
70        $children = array();
71        $i = 0;
72        while ( $Child = $this->cal->fetch() ) {
73            $children[$i]=$Child;
74            $i++;
75        }
76        $this->assertEqual($children,$this->cal->fetchAll());
77    }
78    function testSelection() {
79        require_once(CALENDAR_ROOT . 'Second.php');
80        $selection = array(new Calendar_Second(2003,10,25,13,32,43));
81        $this->cal->build($selection);
82        $i = 0;
83        while ( $Child = $this->cal->fetch() ) {
84            if ( $i == 43 )
85                break;
86            $i++;
87        }
88        $this->assertTrue($Child->isSelected());
89    }
90}
91
92if (!defined('TEST_RUNNING')) {
93    define('TEST_RUNNING', true);
94    $test = &new TestOfMinute();
95    $test->run(new HtmlReporter());
96    $test = &new TestOfMinuteBuild();
97    $test->run(new HtmlReporter());
98}
99?>
Note: See TracBrowser for help on using the repository browser.