Passed
Push — master ( 20412a...e401ec )
by
unknown
02:35
created

testRuleDoesNotApplyToUsedProperties()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6

Duplication

Lines 6
Ratio 100 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 0
dl 6
loc 6
rs 10
c 0
b 0
f 0
1
<?php
2
/**
3
 * This file is part of PHP Mess Detector.
4
 *
5
 * Copyright (c) Manuel Pichler <[email protected]>.
6
 * All rights reserved.
7
 *
8
 * Licensed under BSD License
9
 * For full copyright and license information, please see the LICENSE file.
10
 * Redistributions of files must retain the above copyright notice.
11
 *
12
 * @author Manuel Pichler <[email protected]>
13
 * @copyright Manuel Pichler. All rights reserved.
14
 * @license https://opensource.org/licenses/bsd-license.php BSD License
15
 * @link http://phpmd.org/
16
 */
17
18
namespace PHPMD\Rule\CleanCode;
19
20
use PHPMD\AbstractTest;
21
22
/**
23
 * Test case for the undefined variable rule.
24
 *
25
 * @covers \PHPMD\Rule\UndefinedVariable
26
 * @covers \PHPMD\Rule\AbstractLocalVariable
27
 */
28 View Code Duplication
class UndefinedVariableTest extends AbstractTest
29
{
30
    /**
31
     * testRuleAppliesToUndefinedVariable
32
     *
33
     * @return void
34
     */
35
    public function testRuleAppliesToUndefinedVariable()
36
    {
37
        $rule = new UndefinedVariable();
38
        $rule->setReport($this->getReportMock(1));
39
        $rule->apply($this->getMethod());
40
    }
41
42
    /**
43
     * testRuleAppliesToUndefinedVariableWithDefinedVariable
44
     *
45
     * @return void
46
     */
47
    public function testRuleAppliesToUndefinedVariableWithDefinedVariable()
48
    {
49
        $rule = new UndefinedVariable();
50
        $rule->setReport($this->getReportMock(1));
51
        $rule->apply($this->getMethod());
52
    }
53
54
    /**
55
     * testRuleAppliesToUndefinedVariableOnArray
56
     *
57
     * @return void
58
     */
59
    public function testRuleAppliesToUndefinedVariableOnArray()
60
    {
61
        $rule = new UndefinedVariable();
62
        $rule->setReport($this->getReportMock(1));
63
        $rule->apply($this->getMethod());
64
    }
65
66
    /**
67
     * testRuleAppliesToUndefinedVariableOnArrayWithKeys
68
     *
69
     * @return void
70
     */
71
    public function testRuleAppliesToUndefinedVariableOnArrayWithKeys()
72
    {
73
        $rule = new UndefinedVariable();
74
        $rule->setReport($this->getReportMock(1));
75
        $rule->apply($this->getMethod());
76
    }
77
78
    /**
79
     * testRuleAppliesToUndefinedVariableOnArrayWithKeys
80
     *
81
     * @return void
82
     */
83
    public function testRuleDoesNotApplyToSuperGlobals()
84
    {
85
        $rule = new UndefinedVariable();
86
        $rule->setReport($this->getReportMock(0));
87
        $rule->apply($this->getMethod());
88
    }
89
90
    /**
91
     * testRuleDoesNotApplyToUsedProperties
92
     *
93
     * @return void
94
     */
95
    public function testRuleDoesNotApplyToUsedProperties()
96
    {
97
        $rule = new UndefinedVariable();
98
        $rule->setReport($this->getReportMock(0));
99
        $rule->apply($this->getMethod());
100
    }
101
}
102