DateTest4cnvYear   A
last analyzed

Complexity

Total Complexity 13

Size/Duplication

Total Lines 170
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 2
Bugs 2 Features 1
Metric Value
wmc 13
c 2
b 2
f 1
lcom 0
cbo 1
dl 0
loc 170
rs 10

13 Methods

Rating   Name   Duplication   Size   Complexity  
A setUp() 0 3 1
A test_cnvYear_InvalidArgPart1() 0 7 1
A test_cnvYear_InvalidArgPart2() 0 7 1
A test_cnvYear_InvalidArgPart3() 0 7 1
A test_cnvYear_MeijiPart1() 0 7 1
A test_cnvYear_MeijiPart2() 0 7 1
A test_cnvYear_MeijiPart3() 0 7 1
A test_cnvYear_TaishoPart1() 0 7 1
A test_cnvYear_TaishoPart2() 0 7 1
A test_cnvYear_ShowaPart1() 0 7 1
A test_cnvYear_ShowaPart2() 0 7 1
A test_cnvYear_HeiseiPart1() 0 7 1
A test_cnvYear_HeiseiPart2() 0 7 1
1
<?php
2
/**
3
 * DateTest4cnvYear
4
 *
5
 * Date::cnvYear用テストケース
6
 *
7
 * @package           risoluto
8
 * @author            Risoluto Developers
9
 * @license           http://opensource.org/licenses/bsd-license.php new BSD license
10
 * @copyright     (C) 2008-2015 Risoluto Developers / All Rights Reserved.
11
 */
12
13
//------------------------------------------------------//
14
// 名前空間の定義
15
//------------------------------------------------------//
16
namespace Risoluto;
17
18
//------------------------------------------------------//
19
// テストクラス定義
20
//------------------------------------------------------//
21
class DateTest4cnvYear extends \PHPUnit_Framework_TestCase
22
{
23
    //------------------------------------------------------//
24
    // テストメソッド定義
25
    //------------------------------------------------------//
26
    /**
27
     * setUp()
28
     *
29
     * テストに必要な準備を実施
30
     */
31
    protected function setUp()
32
    {
33
    }
34
35
    /**
36
     * test_cnvYear_InvalidArgPart1()
37
     *
38
     * cnvYear()の挙動をテストする(引数が数値じゃない)
39
     */
40
    public function test_cnvYear_InvalidArgPart1()
41
    {
42
        $test = 'AAAA';
43
        $want = '';
44
45
        $this->assertEquals( Date::cnvYear( $test ), $want );
46
    }
47
48
    /**
49
     * test_cnvYear_InvalidArgPart2()
50
     *
51
     * cnvYear()の挙動をテストする(引数が数値4桁じゃない)
52
     */
53
    public function test_cnvYear_InvalidArgPart2()
54
    {
55
        $test = '13';
56
        $want = '';
57
58
        $this->assertEquals( Date::cnvYear( $test ), $want );
59
    }
60
61
    /**
62
     * test_cnvYear_InvalidArgPart3()
63
     *
64
     * cnvYear()の挙動をテストする(引数が1868より小さい数値)
65
     */
66
    public function test_cnvYear_InvalidArgPart3()
67
    {
68
        $test = '1867';
69
        $want = '';
70
71
        $this->assertEquals( Date::cnvYear( $test ), $want );
72
    }
73
74
    /**
75
     * test_cnvYear_MeijiPart1()
76
     *
77
     * cnvYear()の挙動をテストする(明治元年)
78
     */
79
    public function test_cnvYear_MeijiPart1()
80
    {
81
        $test = '1868';
82
        $want = '明治元年';
83
84
        $this->assertEquals( Date::cnvYear( $test ), $want );
85
    }
86
87
    /**
88
     * test_cnvYear_MeijiPart2()
89
     *
90
     * cnvYear()の挙動をテストする(明治1年)
91
     */
92
    public function test_cnvYear_MeijiPart2()
93
    {
94
        $test = '1869';
95
        $want = '明治2年';
96
97
        $this->assertEquals( Date::cnvYear( $test ), $want );
98
    }
99
100
    /**
101
     * test_cnvYear_MeijiPart3()
102
     *
103
     * cnvYear()の挙動をテストする(明治45年、大正元年)
104
     */
105
    public function test_cnvYear_MeijiPart3()
106
    {
107
        $test = '1912';
108
        $want = '明治45年 / 大正元年';
109
110
        $this->assertEquals( Date::cnvYear( $test ), $want );
111
    }
112
113
    /**
114
     * test_cnvYear_TaishoPart1()
115
     *
116
     * cnvYear()の挙動をテストする(大正2年)
117
     */
118
    public function test_cnvYear_TaishoPart1()
119
    {
120
        $test = '1913';
121
        $want = '大正2年';
122
123
        $this->assertEquals( Date::cnvYear( $test ), $want );
124
    }
125
126
    /**
127
     * test_cnvYear_TaishoPart2()
128
     *
129
     * cnvYear()の挙動をテストする(大正15年、昭和元年)
130
     */
131
    public function test_cnvYear_TaishoPart2()
132
    {
133
        $test = '1926';
134
        $want = '大正15年 / 昭和元年';
135
136
        $this->assertEquals( Date::cnvYear( $test ), $want );
137
    }
138
139
    /**
140
     * test_cnvYear_ShowaPart1()
141
     *
142
     * cnvYear()の挙動をテストする(昭和2年)
143
     */
144
    public function test_cnvYear_ShowaPart1()
145
    {
146
        $test = '1927';
147
        $want = '昭和2年';
148
149
        $this->assertEquals( Date::cnvYear( $test ), $want );
150
    }
151
152
    /**
153
     * test_cnvYear_ShowaPart2()
154
     *
155
     * cnvYear()の挙動をテストする(昭和64年、平成元年)
156
     */
157
    public function test_cnvYear_ShowaPart2()
158
    {
159
        $test = '1989';
160
        $want = '昭和64年 / 平成元年';
161
162
        $this->assertEquals( Date::cnvYear( $test ), $want );
163
    }
164
165
    /**
166
     * test_cnvYear_HeiseiPart1()
167
     *
168
     * cnvYear()の挙動をテストする(平成2年)
169
     */
170
    public function test_cnvYear_HeiseiPart1()
171
    {
172
        $test = '1990';
173
        $want = '平成2年';
174
175
        $this->assertEquals( Date::cnvYear( $test ), $want );
176
    }
177
178
    /**
179
     * test_cnvYear_HeiseiPart2()
180
     *
181
     * cnvYear()の挙動をテストする(平成25年)
182
     */
183
    public function test_cnvYear_HeiseiPart2()
184
    {
185
        $test = '2013';
186
        $want = '平成25年';
187
188
        $this->assertEquals( Date::cnvYear( $test ), $want );
189
    }
190
}