Completed
Push — master ( 5e98ee...3dda2e )
by Michael
04:38
created

SwitchStatementTest::getRule()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 6
Ratio 100 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 6
loc 6
rs 9.4285
cc 1
eloc 3
nc 1
nop 0
1
<?php
2
3
namespace MS\PHPMD\Tests\Unit\CleanCode;
4
5
use MS\PHPMD\Rule\CleanCode\SwitchStatement;
6
use MS\PHPMD\Tests\Unit\AbstractApplyTest;
7
8
/**
9
 * Class SwitchStatementTest
10
 *
11
 * @package MS\PHPMD\Tests\Unit\CleanCode
12
 */
13 View Code Duplication
class SwitchStatementTest extends AbstractApplyTest
0 ignored issues
show
Duplication introduced by
This class 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...
14
{
15
    /**
16
     * @covers MS\PHPMD\Rule\CleanCode\SwitchStatement
17
     */
18
    public function testFindOneSwitchStatement()
19
    {
20
        $node = $this->getMethodNode('TestClass', 'doSomething', [
21
            'SwitchStatement' => [$this->getNode('switch')]
22
        ]);
23
24
        $this->assertRule($node, 1);
25
    }
26
27
    /**
28
     * @covers MS\PHPMD\Rule\CleanCode\SwitchStatement
29
     */
30
    public function testFindNoSwitchStatement()
31
    {
32
        $node = $this->getMethodNode('TestClass', 'doSomething', [
33
            'SwitchStatement' => []
34
        ]);
35
36
        $this->assertRule($node, 0);
37
    }
38
39
    /**
40
     * @return SwitchStatement
41
     */
42
    protected function getRule()
43
    {
44
        $rule = new SwitchStatement();
45
46
        return $rule;
47
    }
48
}
49