DateTest4GenMinSec::test_MinSec_NoArgs()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 67
Code Lines 63

Duplication

Lines 0
Ratio 0 %

Importance

Changes 4
Bugs 2 Features 1
Metric Value
c 4
b 2
f 1
dl 0
loc 67
rs 9.2815
cc 1
eloc 63
nc 1
nop 0

How to fix   Long Method   

Long Method

Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.

For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.

Commonly applied refactorings include:

1
<?php
2
/**
3
 * DateTest4GenMinSec
4
 *
5
 * Date::GenMinSec用テストケース
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 DateTest4GenMinSec extends \PHPUnit_Framework_TestCase
22
{
23
    //------------------------------------------------------//
24
    // テストメソッド定義
25
    //------------------------------------------------------//
26
    /**
27
     * setUp()
28
     *
29
     * テストに必要な準備を実施
30
     */
31
    protected function setUp()
32
    {
33
    }
34
35
    /**
36
     * test_GenMinSec_NoArgs()
37
     *
38
     * GenMinSec()の挙動をテストする(引数なし)
39
     */
40
    public function test_MinSec_NoArgs()
41
    {
42
        $want = [
43
            '00' => '00',
44
            '01' => '01',
45
            '02' => '02',
46
            '03' => '03',
47
            '04' => '04',
48
            '05' => '05',
49
            '06' => '06',
50
            '07' => '07',
51
            '08' => '08',
52
            '09' => '09',
53
            '10' => '10',
54
            '11' => '11',
55
            '12' => '12',
56
            '13' => '13',
57
            '14' => '14',
58
            '15' => '15',
59
            '16' => '16',
60
            '17' => '17',
61
            '18' => '18',
62
            '19' => '19',
63
            '20' => '20',
64
            '21' => '21',
65
            '22' => '22',
66
            '23' => '23',
67
            '24' => '24',
68
            '25' => '25',
69
            '26' => '26',
70
            '27' => '27',
71
            '28' => '28',
72
            '29' => '29',
73
            '30' => '30',
74
            '31' => '31',
75
            '32' => '32',
76
            '33' => '33',
77
            '34' => '34',
78
            '35' => '35',
79
            '36' => '36',
80
            '37' => '37',
81
            '38' => '38',
82
            '39' => '39',
83
            '40' => '40',
84
            '41' => '41',
85
            '42' => '42',
86
            '43' => '43',
87
            '44' => '44',
88
            '45' => '45',
89
            '46' => '46',
90
            '47' => '47',
91
            '48' => '48',
92
            '49' => '49',
93
            '50' => '50',
94
            '51' => '51',
95
            '52' => '52',
96
            '53' => '53',
97
            '54' => '54',
98
            '55' => '55',
99
            '56' => '56',
100
            '57' => '57',
101
            '58' => '58',
102
            '59' => '59',
103
        ];
104
105
        $this->assertEquals( Date::genMinSec(), $want );
106
    }
107
108
    /**
109
     * test_GenMinSec_Args1()
110
     *
111
     * GenMonth()の挙動をテストする(引数1つ)
112
     */
113 View Code Duplication
    public function test_GenMinSec_Args1()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
114
    {
115
        $want = [
116
            '' => '',
117
            '00' => '00',
118
            '01' => '01',
119
            '02' => '02',
120
            '03' => '03',
121
            '04' => '04',
122
            '05' => '05',
123
            '06' => '06',
124
            '07' => '07',
125
            '08' => '08',
126
            '09' => '09',
127
            '10' => '10',
128
            '11' => '11',
129
            '12' => '12',
130
            '13' => '13',
131
            '14' => '14',
132
            '15' => '15',
133
            '16' => '16',
134
            '17' => '17',
135
            '18' => '18',
136
            '19' => '19',
137
            '20' => '20',
138
            '21' => '21',
139
            '22' => '22',
140
            '23' => '23',
141
            '24' => '24',
142
            '25' => '25',
143
            '26' => '26',
144
            '27' => '27',
145
            '28' => '28',
146
            '29' => '29',
147
            '30' => '30',
148
            '31' => '31',
149
            '32' => '32',
150
            '33' => '33',
151
            '34' => '34',
152
            '35' => '35',
153
            '36' => '36',
154
            '37' => '37',
155
            '38' => '38',
156
            '39' => '39',
157
            '40' => '40',
158
            '41' => '41',
159
            '42' => '42',
160
            '43' => '43',
161
            '44' => '44',
162
            '45' => '45',
163
            '46' => '46',
164
            '47' => '47',
165
            '48' => '48',
166
            '49' => '49',
167
            '50' => '50',
168
            '51' => '51',
169
            '52' => '52',
170
            '53' => '53',
171
            '54' => '54',
172
            '55' => '55',
173
            '56' => '56',
174
            '57' => '57',
175
            '58' => '58',
176
            '59' => '59',
177
        ];
178
179
        $this->assertEquals( Date::genMinSec( true ), $want );
180
    }
181
182
    /**
183
     * test_GenMinSec_Args2()
184
     *
185
     * GenMonth()の挙動をテストする(引数2つ)
186
     */
187 View Code Duplication
    public function test_GenMinSec_Args2()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
188
    {
189
        $want = [
190
            '--' => '',
191
            '00' => '00',
192
            '01' => '01',
193
            '02' => '02',
194
            '03' => '03',
195
            '04' => '04',
196
            '05' => '05',
197
            '06' => '06',
198
            '07' => '07',
199
            '08' => '08',
200
            '09' => '09',
201
            '10' => '10',
202
            '11' => '11',
203
            '12' => '12',
204
            '13' => '13',
205
            '14' => '14',
206
            '15' => '15',
207
            '16' => '16',
208
            '17' => '17',
209
            '18' => '18',
210
            '19' => '19',
211
            '20' => '20',
212
            '21' => '21',
213
            '22' => '22',
214
            '23' => '23',
215
            '24' => '24',
216
            '25' => '25',
217
            '26' => '26',
218
            '27' => '27',
219
            '28' => '28',
220
            '29' => '29',
221
            '30' => '30',
222
            '31' => '31',
223
            '32' => '32',
224
            '33' => '33',
225
            '34' => '34',
226
            '35' => '35',
227
            '36' => '36',
228
            '37' => '37',
229
            '38' => '38',
230
            '39' => '39',
231
            '40' => '40',
232
            '41' => '41',
233
            '42' => '42',
234
            '43' => '43',
235
            '44' => '44',
236
            '45' => '45',
237
            '46' => '46',
238
            '47' => '47',
239
            '48' => '48',
240
            '49' => '49',
241
            '50' => '50',
242
            '51' => '51',
243
            '52' => '52',
244
            '53' => '53',
245
            '54' => '54',
246
            '55' => '55',
247
            '56' => '56',
248
            '57' => '57',
249
            '58' => '58',
250
            '59' => '59',
251
        ];
252
253
        $this->assertEquals( Date::genMinSec( true, '--' ), $want );
254
    }
255
256
    /**
257
     * test_GenMinSec_Args3()
258
     *
259
     * GenMonth()の挙動をテストする(引数3つ)
260
     */
261 View Code Duplication
    public function test_GenMinSec_Args3()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
262
    {
263
        $want = [
264
            '--' => '--',
265
            '00' => '00',
266
            '01' => '01',
267
            '02' => '02',
268
            '03' => '03',
269
            '04' => '04',
270
            '05' => '05',
271
            '06' => '06',
272
            '07' => '07',
273
            '08' => '08',
274
            '09' => '09',
275
            '10' => '10',
276
            '11' => '11',
277
            '12' => '12',
278
            '13' => '13',
279
            '14' => '14',
280
            '15' => '15',
281
            '16' => '16',
282
            '17' => '17',
283
            '18' => '18',
284
            '19' => '19',
285
            '20' => '20',
286
            '21' => '21',
287
            '22' => '22',
288
            '23' => '23',
289
            '24' => '24',
290
            '25' => '25',
291
            '26' => '26',
292
            '27' => '27',
293
            '28' => '28',
294
            '29' => '29',
295
            '30' => '30',
296
            '31' => '31',
297
            '32' => '32',
298
            '33' => '33',
299
            '34' => '34',
300
            '35' => '35',
301
            '36' => '36',
302
            '37' => '37',
303
            '38' => '38',
304
            '39' => '39',
305
            '40' => '40',
306
            '41' => '41',
307
            '42' => '42',
308
            '43' => '43',
309
            '44' => '44',
310
            '45' => '45',
311
            '46' => '46',
312
            '47' => '47',
313
            '48' => '48',
314
            '49' => '49',
315
            '50' => '50',
316
            '51' => '51',
317
            '52' => '52',
318
            '53' => '53',
319
            '54' => '54',
320
            '55' => '55',
321
            '56' => '56',
322
            '57' => '57',
323
            '58' => '58',
324
            '59' => '59',
325
        ];
326
327
        $this->assertEquals( Date::genMinSec( true, '--', '--' ), $want );
328
    }
329
}