testMoreWordsInMethod()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 6

Duplication

Lines 10
Ratio 100 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 10
loc 10
rs 9.4285
cc 1
eloc 6
nc 1
nop 0
1
<?php
2
3
namespace MS\PHPMD\Tests\Unit\Test;
4
5
use MS\PHPMD\Rule\Test\MethodNameUnderstandable;
6
7
/**
8
 * Class MethodNameUnderstandableTest
9
 *
10
 * @package MS\PHPMD\Tests\Unit\Test
11
 */
12
class MethodNameUnderstandableTest extends AbstractClassTest
13
{
14
    /**
15
     * @covers MS\PHPMD\Rule\Test\MethodNameUnderstandable
16
     * @covers MS\PHPMD\Rule\Test\AbstractTestRule
17
     */
18 View Code Duplication
    public function testIgnoreMethodsWithoutTestPrefix()
0 ignored issues
show
Duplication introduced by
This method 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...
19
    {
20
        $methodNode = $this->getMethodNode(self::CLASS_NAME, 'getEntityManager');
21
22
        $node = \Mockery::mock('PHPMD\Node\ClassNode');
23
        $node->shouldReceive('getImage')->andReturn(self::CLASS_NAME);
24
        $node->shouldReceive('getMethods')->andReturn([$methodNode]);
25
26
        $this->assertRule($node, 0);
27
    }
28
29
    /**
30
     * @covers MS\PHPMD\Rule\Test\MethodNameUnderstandable
31
     * @covers MS\PHPMD\Rule\Test\AbstractTestRule
32
     */
33 View Code Duplication
    public function testMoreWordsInMethod()
0 ignored issues
show
Duplication introduced by
This method 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...
34
    {
35
        $methodNode = $this->getMethodNode(self::CLASS_NAME, 'testCanAddTwoNumbers');
36
37
        $node = \Mockery::mock('PHPMD\Node\ClassNode');
38
        $node->shouldReceive('getImage')->andReturn(self::CLASS_NAME);
39
        $node->shouldReceive('getMethods')->andReturn([$methodNode]);
40
41
        $this->assertRule($node, 0);
42
    }
43
44
    /**
45
     * @covers MS\PHPMD\Rule\Test\MethodNameUnderstandable
46
     * @covers MS\PHPMD\Rule\Test\AbstractTestRule
47
     */
48 View Code Duplication
    public function testLessWordsInMethod()
0 ignored issues
show
Duplication introduced by
This method 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...
49
    {
50
        $methodNode = $this->getMethodNode(self::CLASS_NAME, 'testAdd');
51
52
        $node = \Mockery::mock('PHPMD\Node\ClassNode');
53
        $node->shouldReceive('getImage')->andReturn(self::CLASS_NAME);
54
        $node->shouldReceive('getMethods')->andReturn([$methodNode]);
55
56
        $this->assertRule($node, 1);
57
    }
58
59
    /**
60
     * @return MethodNameUnderstandable
61
     */
62
    protected function getRule()
63
    {
64
        $rule =  new MethodNameUnderstandable();
65
        $rule->addProperty('number', '3');
66
        $rule->addProperty('regex', '([A-Z])');
67
68
        return $rule;
69
    }
70
}
71