MeaninglessMethodNameTest   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A testFindMeaninglessMethodName() 0 6 1
A testFindNoMeaninglessMethodName() 0 6 1
A getRule() 0 8 1
1
<?php
2
3
namespace MS\PHPMD\Tests\Unit\CleanCode;
4
5
use MS\PHPMD\Rule\CleanCode\MeaninglessMethodName;
6
use MS\PHPMD\Tests\Unit\AbstractApplyTest;
7
8
/**
9
 * Class MeaninglessMethodNameTest
10
 *
11
 * @package MS\PHPMD\Tests\Unit\CleanCode
12
 */
13
class MeaninglessMethodNameTest extends AbstractApplyTest
14
{
15
    /**
16
     * @covers MS\PHPMD\Rule\CleanCode\MeaninglessMethodName
17
     */
18
    public function testFindMeaninglessMethodName()
19
    {
20
        $node = $this->getMethodNode('TestClass', 'getData');
21
22
        $this->assertRule($node, 1);
23
    }
24
25
    /**
26
     * @covers MS\PHPMD\Rule\CleanCode\MeaninglessMethodName
27
     */
28
    public function testFindNoMeaninglessMethodName()
29
    {
30
        $node = $this->getMethodNode('TestClass', 'getStatisticData');
31
32
        $this->assertRule($node, 0);
33
    }
34
35
    /**
36
     * @return MeaninglessMethodName
37
     */
38
    protected function getRule()
39
    {
40
        $rule = new MeaninglessMethodName();
41
        $rule->addProperty('delimiter', ',');
42
        $rule->addProperty('meaninglessNames', 'getData');
43
44
        return $rule;
45
    }
46
}
47