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

Revision 22567, 2.8 KB checked in by shutta, 11 years ago (diff)

#2043 (typo修正・ソース整形・ソースコメントの改善 for 2.12.4)
Zend Framework PHP 標準コーディング規約のコーディングスタイルへ準拠。
classおよびfunctionの開始波括弧「{」のスタイルを修正。

Line 
1<?php
2/*
3 * This file is part of EC-CUBE
4 *
5 * Copyright(c) 2000-2013 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
30    protected function setUp()
31    {
32        parent::setUp();
33        $this->objDate = new SC_Date_Ex();
34    }
35
36    protected function tearDown()
37    {
38        parent::tearDown();
39    }
40
41    /////////////////////////////////////////
42 
43    public function testGetZeroYear_要素の数が4の配列を返す()
44    {
45        $this->expected = 4;
46        $this->actual = count($this->objDate->getZeroYear());
47        $this->verify("配列の長さ");
48    }
49   
50    public function testGetZeroYear_最小値が2桁表記の今年の配列を返す()
51    {
52        $this->expected = DATE('y');
53        $this->actual = min($this->objDate->getZeroYear());
54        $this->verify("最小値;今年");
55    }
56   
57    public function testGetZeroYear_最低値が引数の年の2桁表記の配列を返す()
58    {
59        $this->expected = '07';
60        $this->actual = min($this->objDate->getZeroYear('2007'));
61
62        $this->verify("引数が最低値");
63    }
64   
65    public function testGetZeroYear_最低値がメンバー変数の年の2桁表記の配列を返す()
66    {
67        $this->expected = '04';
68        $this->objDate->setStartYear('2004');
69        $this->actual = min($this->objDate->getZeroYear());
70
71        $this->verify("メンバー変数が最低値");
72    }
73   
74    public function testGetZeroYear_最大値が3年後の2桁表記の配列を返す()
75    {
76        $this->expected = DATE('y')+3;
77        $this->actual = max($this->objDate->getZeroYear());
78
79        $this->verify("最大値;3年後");
80    }
81   
82    public function testGetZeroYear_最大値がメンバ変数の2桁表記の配列を返す()
83    {
84        $this->expected = '20';
85        $this->objDate->setEndYear('2020');
86        $this->actual = max($this->objDate->getZeroYear());
87
88        $this->verify("メンバー変数が最大値");
89    }
90}
91
Note: See TracBrowser for help on using the repository browser.