testApplyWithManagerClass()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 6

Duplication

Lines 10
Ratio 100 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 10
loc 10
rs 9.4285
cc 1
eloc 6
nc 1
nop 0
1
<?php
2
3
namespace MS\PHPMD\Tests\Unit\CleanCode;
4
5
use MS\PHPMD\Rule\CleanCode\ClassNameSingleResponsibility;
6
use MS\PHPMD\Tests\Unit\AbstractApplyTest;
7
8
/**
9
 * Class ClassNameSingleResponsibilityTest
10
 *
11
 * @package MS\PHPMD\Tests\Unit\CleanCode
12
 */
13
class ClassNameSingleResponsibilityTest extends AbstractApplyTest
14
{
15
    /**
16
     * @covers MS\PHPMD\Rule\CleanCode\ClassNameSingleResponsibility
17
     */
18 View Code Duplication
    public function testApplyWithSingleResponsibilityClass()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
19
    {
20
        $className = 'UserConverter';
21
22
        $classNode = \Mockery::mock('PHPMD\Node\ClassNode');
23
        $classNode->shouldReceive('getImage')->andReturn($className);
24
        $classNode->shouldReceive('getName')->andReturn($className);
25
26
        $this->assertRule($classNode, 0);
27
    }
28
29
    /**
30
     * @covers MS\PHPMD\Rule\CleanCode\ClassNameSingleResponsibility
31
     */
32 View Code Duplication
    public function testApplyWithManagerClass()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
33
    {
34
        $className = 'UserManager';
35
36
        $classNode = \Mockery::mock('PHPMD\Node\ClassNode');
37
        $classNode->shouldReceive('getImage')->andReturn($className);
38
        $classNode->shouldReceive('getName')->andReturn($className);
39
40
        $this->assertRule($classNode, 1);
41
    }
42
43
    /**
44
     * @return ClassNameSingleResponsibility
45
     */
46
    protected function getRule()
47
    {
48
        $rule =  new ClassNameSingleResponsibility();
49
        $rule->addProperty('delimiter', ',');
50
        $rule->addProperty('suffixes', 'Manager,Handler');
51
52
        return $rule;
53
    }
54
}
55