EntityConstantsTest   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A testRuleWithFinalStaticClass() 0 8 1
A testEntityConstantsRule() 0 8 1
1
<?php
2
3
namespace MS\PHPMD\Tests\Functional\Symfony2;
4
5
use MS\PHPMD\Tests\Functional\AbstractProcessTest;
6
7
/**
8
 * Class EntityConstantsTest
9
 *
10
 * @package MS\PHPMD\Tests\Functional\Symfony2
11
 */
12
class EntityConstantsTest extends AbstractProcessTest
13
{
14
    /**
15
     * @covers MS\PHPMD\Rule\Symfony2\EntityConstants
16
     * @covers MS\PHPMD\Rule\Symfony2\AbstractEntityRule
17
     */
18
    public function testEntityConstantsRule()
19
    {
20
        $output = $this
21
            ->runPhpmd('Entity/Foo.php', 'symfony2.xml')
22
            ->getOutput();
23
24
        $this->assertContains('Entity/Foo.php:10	Don\'t contain constants in your entity. Important information are distribute throughout the project. You reduce the reusability.', $output);
25
    }
26
27
    /**
28
     * @covers MS\PHPMD\Rule\Symfony2\EntityConstants
29
     * @covers MS\PHPMD\Rule\Symfony2\AbstractEntityRule
30
     */
31
    public function testRuleWithFinalStaticClass()
32
    {
33
        $output = $this
34
            ->runPhpmd('Statics/Identifier.php', 'symfony2.xml')
35
            ->getOutput();
36
37
        $this->assertEmpty(trim($output));
38
    }
39
}
40