DateTest4GenMonth   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 117
Duplicated Lines 51.28 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 4
Bugs 2 Features 1
Metric Value
wmc 5
c 4
b 2
f 1
lcom 0
cbo 1
dl 60
loc 117
rs 10

5 Methods

Rating   Name   Duplication   Size   Complexity  
A setUp() 0 3 1
A test_GenMonth_NoArgs() 0 19 1
A test_GenMonth_Args1() 20 20 1
A test_GenMonth_Args2() 20 20 1
A test_GenMonth_Args3() 20 20 1

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

1
<?php
2
/**
3
 * DateTest4GenMonth
4
 *
5
 * Date::GenMonth用テストケース
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 DateTest4GenMonth extends \PHPUnit_Framework_TestCase
22
{
23
    //------------------------------------------------------//
24
    // テストメソッド定義
25
    //------------------------------------------------------//
26
    /**
27
     * setUp()
28
     *
29
     * テストに必要な準備を実施
30
     */
31
    protected function setUp()
32
    {
33
    }
34
35
    /**
36
     * test_GenMonth_NoArgs()
37
     *
38
     * GenMonth()の挙動をテストする(引数なし)
39
     */
40
    public function test_GenMonth_NoArgs()
41
    {
42
        $want = [
43
            '01' => '01',
44
            '02' => '02',
45
            '03' => '03',
46
            '04' => '04',
47
            '05' => '05',
48
            '06' => '06',
49
            '07' => '07',
50
            '08' => '08',
51
            '09' => '09',
52
            '10' => '10',
53
            '11' => '11',
54
            '12' => '12',
55
        ];
56
57
        $this->assertEquals( Date::genMonth(), $want );
58
    }
59
60
    /**
61
     * test_GenMonth_Args1()
62
     *
63
     * GenMonth()の挙動をテストする(引数1つ)
64
     */
65 View Code Duplication
    public function test_GenMonth_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...
66
    {
67
        $want = [
68
            '' => '',
69
            '01' => '01',
70
            '02' => '02',
71
            '03' => '03',
72
            '04' => '04',
73
            '05' => '05',
74
            '06' => '06',
75
            '07' => '07',
76
            '08' => '08',
77
            '09' => '09',
78
            '10' => '10',
79
            '11' => '11',
80
            '12' => '12',
81
        ];
82
83
        $this->assertEquals( Date::genMonth( true ), $want );
84
    }
85
86
    /**
87
     * test_GenMonth_Args2()
88
     *
89
     * GenMonth()の挙動をテストする(引数2つ)
90
     */
91 View Code Duplication
    public function test_GenMonth_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...
92
    {
93
        $want = [
94
            '--' => '',
95
            '01' => '01',
96
            '02' => '02',
97
            '03' => '03',
98
            '04' => '04',
99
            '05' => '05',
100
            '06' => '06',
101
            '07' => '07',
102
            '08' => '08',
103
            '09' => '09',
104
            '10' => '10',
105
            '11' => '11',
106
            '12' => '12',
107
        ];
108
109
        $this->assertEquals( Date::genMonth( true, '--' ), $want );
110
    }
111
112
    /**
113
     * test_GenMonth_Args3()
114
     *
115
     * GenMonth()の挙動をテストする(引数3つ)
116
     */
117 View Code Duplication
    public function test_GenMonth_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...
118
    {
119
        $want = [
120
            '--' => '--',
121
            '01' => '01',
122
            '02' => '02',
123
            '03' => '03',
124
            '04' => '04',
125
            '05' => '05',
126
            '06' => '06',
127
            '07' => '07',
128
            '08' => '08',
129
            '09' => '09',
130
            '10' => '10',
131
            '11' => '11',
132
            '12' => '12',
133
        ];
134
135
        $this->assertEquals( Date::genMonth( true, '--', '--' ), $want );
136
    }
137
}