source: branches/version-2_12-dev/tests/class/SC_Date/SC_Date_getZeroYearTest.php @ 22187

Revision 22187, 2.8 KB checked in by poego, 10 years ago (diff)

#2000 SC_Date‚̃eƒXƒgƒR[ƒh‚ðì¬

Line 
1<?php
2/*
3 * This file is part of EC-CUBE
4 *
5 * Copyright(c) 2000-2012 LOCKON CO.,LTD. All Rights Reserved.
6 *
7 * http://www.lockon.co.jp/
8 *
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License
11 * as published by the Free Software Foundation; either version 2
12 * of the License, or (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
22 */
23
24$HOME = realpath(dirname(__FILE__)) . "/../../..";
25require_once($HOME . "/tests/class/Common_TestCase.php");
26
27class SC_Date_getZeroYearTest extends Common_TestCase {
28
29    protected function setUp() {
30        parent::setUp();
31        $this->objDate = new SC_Date_Ex();
32    }
33
34    protected function tearDown() {
35        parent::tearDown();
36    }
37
38    /////////////////////////////////////////
39 
40    public function testGetZeroYear_要素の数が4の配列を返す() {
41        $this->expected = 4;
42        $this->actual = count($this->objDate->getZeroYear());
43        $this->verify("配列の長さ");
44    }
45   
46    public function testGetZeroYear_最小値が2桁表記の今年の配列を返す() {
47        $this->expected = DATE('y');
48        $this->actual = min($this->objDate->getZeroYear());
49        $this->verify("最小値;今年");
50    }
51   
52    public function testGetZeroYear_最低値が引数の年の2桁表記の配列を返す() {
53        $this->expected = '07';
54        $this->actual = min($this->objDate->getZeroYear('2007'));
55
56        $this->verify("引数が最低値");
57    }
58   
59    public function testGetZeroYear_最低値がメンバー変数の年の2桁表記の配列を返す() {
60        $this->expected = '04';
61        $this->objDate->setStartYear('2004');
62        $this->actual = min($this->objDate->getZeroYear());
63
64        $this->verify("メンバー変数が最低値");
65    }
66   
67    public function testGetZeroYear_最大値が3年後の2桁表記の配列を返す() {
68        $this->expected = DATE('y')+3;
69        $this->actual = max($this->objDate->getZeroYear());
70
71        $this->verify("最大値;3年後");
72    }
73   
74    public function testGetZeroYear_最大値がメンバ変数の2桁表記の配列を返す() {
75        $this->expected = '20';
76        $this->objDate->setEndYear('2020');
77        $this->actual = max($this->objDate->getZeroYear());
78
79        $this->verify("メンバー変数が最大値");
80    }
81}
82
Note: See TracBrowser for help on using the repository browser.