ConfTest4GetParseStatus   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 39
Duplicated Lines 100 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 4
Bugs 2 Features 1
Metric Value
wmc 3
c 4
b 2
f 1
lcom 0
cbo 1
dl 39
loc 39
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A setUp() 3 3 1
A test_GetParseStatus_BeforeParsed() 6 6 1
A test_GetParseStatus_AfterParsed() 7 7 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
 * ConfTest4GetParseStatus
4
 *
5
 * Conf::GetParseStatus用テストケース
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
namespace Risoluto;
16
17
//------------------------------------------------------//
18
// テストクラス定義
19
//------------------------------------------------------//
20 View Code Duplication
class ConfTest4GetParseStatus extends \PHPUnit_Framework_TestCase
21
{
22
    //------------------------------------------------------//
23
    // テストメソッド定義
24
    //------------------------------------------------------//
25
    /**
26
     * setUp()
27
     *
28
     * テストに必要な準備を実施
29
     */
30
    protected function setUp()
31
    {
32
    }
33
34
    /**
35
     * test_GetParseStatus_BeforeParsed()
36
     *
37
     * 未パース時のGetParseStatus()の挙動をテストする
38
     */
39
    public function test_GetParseStatus_BeforeParsed()
40
    {
41
        $instance = new Conf;
42
        $this->assertFalse( $instance->getParseStatus() );
43
        unset( $instance );
44
    }
45
46
    /**
47
     * test_GetParseStatus_AfterParsed()
48
     *
49
     * パース後のGetParseStatus()の挙動をテストする
50
     */
51
    public function test_GetParseStatus_AfterParsed()
52
    {
53
        $instance = new Conf;
54
        $instance->parse( RISOLUTO_CONF . 'risoluto.ini' );
55
        $this->assertTrue( $instance->getParseStatus() );
56
        unset( $instance );
57
    }
58
}
59