InlineIfTest::getRule()   A
last analyzed

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\InlineIf;
6
use MS\PHPMD\Tests\Unit\AbstractApplyTest;
7
8
/**
9
 * Class InlineIfTest
10
 *
11
 * @package MS\PHPMD\Tests\Unit\CleanCode
12
 */
13 View Code Duplication
class InlineIfTest 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\InlineIf
17
     */
18
    public function testFindOneInlineIf()
19
    {
20
        $node = $this->getMethodNode('TestClass', 'doSomething', [
21
            'ConditionalExpression' => [$this->getNode('?')]
22
        ]);
23
24
        $this->assertRule($node, 1);
25
    }
26
27
    /**
28
     * @covers MS\PHPMD\Rule\CleanCode\InlineIf
29
     */
30
    public function testFindNoInlineIf()
31
    {
32
        $node = $this->getMethodNode('TestClass', 'tryMore', [
33
            'ConditionalExpression' => []
34
        ]);
35
36
        $this->assertRule($node, 0);
37
    }
38
39
    /**
40
     * @return InlineIf
41
     */
42
    protected function getRule()
43
    {
44
        $rule = new InlineIf();
45
46
        return $rule;
47
    }
48
}
49