TextTest4CheckFalseVal   A
last analyzed

Complexity

Total Complexity 8

Size/Duplication

Total Lines 105
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

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

8 Methods

Rating   Name   Duplication   Size   Complexity  
A setUp() 0 3 1
A test_CheckFalseVal_true1() 0 7 1
A test_CheckFalseVal_true2() 0 7 1
A test_CheckFalseVal_true3() 0 7 1
A test_CheckFalseVal_False1() 0 7 1
A test_CheckFalseVal_False2() 0 7 1
A test_CheckFalseVal_False3() 0 7 1
A test_CheckFalseVal_False4() 0 7 1
1
<?php
2
/**
3
 * TextTest4CheckFalseVal
4
 *
5
 * Text::CheckFalseVal用テストケース
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 TextTest4CheckFalseVal extends \PHPUnit_Framework_TestCase
22
{
23
    //------------------------------------------------------//
24
    // テストメソッド定義
25
    //------------------------------------------------------//
26
    /**
27
     * setUp()
28
     *
29
     * テストに必要な準備を実施
30
     */
31
    protected function setUp()
32
    {
33
    }
34
35
    /**
36
     * test_CheckFalseVal_true1()
37
     *
38
     * checkFalseVal()の挙動をテストする(falseではない文字列、代替文字なし、厳密判定なし)
39
     */
40
    public function test_CheckFalseVal_true1()
41
    {
42
        $test = 'abcde';
43
        $want = 'abcde';
44
45
        $this->assertEquals( Text::checkFalseVal( $test ), $want );
46
    }
47
48
    /**
49
     * test_CheckFalseVal_true2()
50
     *
51
     * checkFalseVal()の挙動をテストする(falseではない文字列、代替文字あり、厳密判定なし)
52
     */
53
    public function test_CheckFalseVal_true2()
54
    {
55
        $test = 'abcde';
56
        $want = 'abcde';
57
58
        $this->assertEquals( Text::checkFalseVal( $test, 'test' ), $want );
59
    }
60
61
    /**
62
     * test_CheckFalseVal_true3()
63
     *
64
     * checkFalseVal()の挙動をテストする(falseではない文字列、代替文字あり、厳密判定あり)
65
     */
66
    public function test_CheckFalseVal_true3()
67
    {
68
        $test = 'abcde';
69
        $want = 'abcde';
70
71
        $this->assertEquals( Text::checkFalseVal( $test, 'test', true ), $want );
72
    }
73
74
    /**
75
     * test_CheckFalseVal_False1()
76
     *
77
     * checkFalseVal()の挙動をテストする(falseな文字列、代替文字列なし、厳密判定なし)
78
     */
79
    public function test_CheckFalseVal_False1()
80
    {
81
        $test = '0';
82
        $want = '';
83
84
        $this->assertEquals( Text::checkFalseVal( $test ), $want );
85
    }
86
87
    /**
88
     * test_CheckFalseVal_False2()
89
     *
90
     * checkFalseVal()の挙動をテストする(falseな文字列、代替文字列あり、厳密判定なし)
91
     */
92
    public function test_CheckFalseVal_False2()
93
    {
94
        $test = '0';
95
        $want = 'test';
96
97
        $this->assertEquals( Text::checkFalseVal( $test, 'test' ), $want );
98
    }
99
100
    /**
101
     * test_CheckFalseVal_False3()
102
     *
103
     * checkFalseVal()の挙動をテストする(falseな文字列、代替文字列なし、厳密判定あり)
104
     */
105
    public function test_CheckFalseVal_False3()
106
    {
107
        $test = '0';
108
        $want = '0';
109
110
        $this->assertEquals( Text::checkFalseVal( $test, 'test', true ), $want );
111
    }
112
113
    /**
114
     * test_CheckFalseVal_False4()
115
     *
116
     * checkFalseVal()の挙動をテストする(false、代替文字列なし、厳密判定あり)
117
     */
118
    public function test_CheckFalseVal_False4()
119
    {
120
        $test = false;
121
        $want = 'test';
122
123
        $this->assertEquals( Text::checkFalseVal( $test, 'test', true ), $want );
0 ignored issues
show
Documentation introduced by Yuta Hayakawa
$test is of type boolean, but the function expects a string.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
124
    }
125
}