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__)) . "/../../.."; |
---|
25 | require_once($HOME . "/tests/class/Common_TestCase.php"); |
---|
26 | |
---|
27 | class SC_Date_getMonthTest 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 testGetMonth_要素の数が12の配列を返す() |
---|
44 | { |
---|
45 | $this->expected = 12; |
---|
46 | $this->actual = count($this->objDate->getMonth()); |
---|
47 | |
---|
48 | $this->verify("配列の長さ"); |
---|
49 | } |
---|
50 | |
---|
51 | public function testGetMonth_要素の最低値が1の配列を返す() |
---|
52 | { |
---|
53 | $this->expected = 1; |
---|
54 | $this->actual = min($this->objDate->getMonth()); |
---|
55 | |
---|
56 | $this->verify("配列の最低値"); |
---|
57 | } |
---|
58 | |
---|
59 | public function testGetMonth_要素の最大値が12の配列を返す() |
---|
60 | { |
---|
61 | $this->expected = 12; |
---|
62 | $this->actual = max($this->objDate->getMonth()); |
---|
63 | |
---|
64 | $this->verify("配列の最大値"); |
---|
65 | } |
---|
66 | |
---|
67 | public function testGetMonth_TRUEを与えた場合要素の数が13の配列を返す() |
---|
68 | { |
---|
69 | $this->expected = 13; |
---|
70 | $this->actual = count($this->objDate->getMonth(true)); |
---|
71 | |
---|
72 | $this->verify("デフォルトを設定した配列の長さ"); |
---|
73 | } |
---|
74 | |
---|
75 | public function testGetMonth_TRUEを与えた場合ーー含まれるの配列を返す() |
---|
76 | { |
---|
77 | $result = in_array('--', $this->objDate->getMonth(true)); |
---|
78 | |
---|
79 | $this->assertTrue($result, "デフォルトの値"); |
---|
80 | } |
---|
81 | |
---|
82 | } |
---|
83 | |
---|