ConfTest4Parse   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 38
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 38
loc 38
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A setUp() 3 3 1
A test_ParseSet_InvalidFile() 6 6 1
A test_ParseSet_ValidFile() 6 6 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
 * ConfTest4Parse
4
 *
5
 * Conf::Parse用テストケース
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 ConfTest4Parse extends \PHPUnit_Framework_TestCase
21
{
22
    //------------------------------------------------------//
23
    // テストメソッド定義
24
    //------------------------------------------------------//
25
    /**
26
     * setUp()
27
     *
28
     * テストに必要な準備を実施
29
     */
30
    protected function setUp()
31
    {
32
    }
33
34
    /**
35
     * test_ParseSet_InvalidFile()
36
     *
37
     * Iniファイル形式ではないファイルが指定された場合のParse()の挙動をテストする
38
     */
39
    public function test_ParseSet_InvalidFile()
40
    {
41
        $instance = new Conf;
42
        $this->assertFalse( $instance->parse( '/dev/null' ) );
43
        unset( $instance );
44
    }
45
46
    /**
47
     * test_ParseSet_ValidFile()
48
     *
49
     * Iniファイル形式のファイルが指定された場合のParse()の挙動をテストする
50
     */
51
    public function test_ParseSet_ValidFile()
52
    {
53
        $instance = new Conf;
54
        $this->assertTrue( $instance->parse( RISOLUTO_CONF . 'risoluto.ini' ) );
55
        unset( $instance );
56
    }
57
}
58