ClassNameSingleResponsibilityTest   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A testClassNameSingleResponsibilityRule() 0 8 1
A testRuleWithSingleResponsibilityClass() 0 8 1
1
<?php
2
3
namespace MS\PHPMD\Tests\Functional\CleanCode;
4
5
use MS\PHPMD\Tests\Functional\AbstractProcessTest;
6
7
/**
8
 * Class ClassNameSingleResponsibility
9
 *
10
 * @package PHPMD\Tests\Functional\CleanCode
11
 */
12
class ClassNameSingleResponsibilityTest extends AbstractProcessTest
13
{
14
    /**
15
     * @covers MS\PHPMD\Rule\CleanCode\ClassNameSingleResponsibility
16
     */
17
    public function testClassNameSingleResponsibilityRule()
18
    {
19
        $output = $this
20
            ->runPhpmd('Service/GeneralManager.php', 'cleancode.xml')
21
            ->getOutput();
22
23
        $this->assertContains('Service/GeneralManager.php:8	Try to avoid general suffixes like Manager,Handler,Helper,Util,Utility,Information,Processor found Manager. It might violate of the single responsibility principle.', $output);
24
    }
25
26
    /**
27
     * @covers MS\PHPMD\Rule\CleanCode\ClassNameSingleResponsibility
28
     */
29
    public function testRuleWithSingleResponsibilityClass()
30
    {
31
        $output = $this
32
            ->runPhpmd('FooController.php', 'cleancode.xml')
33
            ->getOutput();
34
35
        $this->assertEmpty(trim($output));
36
    }
37
}
38