testRuleWithSingleResponsibilityClass()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 8
rs 9.4285
cc 1
eloc 5
nc 1
nop 0
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