MethodNumberOfMocksTest::testMoreMocks()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 17
Code Lines 11

Duplication

Lines 17
Ratio 100 %

Importance

Changes 2
Bugs 1 Features 1
Metric Value
c 2
b 1
f 1
dl 17
loc 17
rs 9.4285
cc 1
eloc 11
nc 1
nop 0
1
<?php
2
3
namespace MS\PHPMD\Tests\Unit\Test;
4
5
use MS\PHPMD\Rule\Test\MethodNumberOfMocks;
6
7
/**
8
 * Class MethodNumberOfMocksTest
9
 *
10
 * @package MS\PHPMD\Tests\Unit\Test
11
 */
12
class MethodNumberOfMocksTest extends AbstractClassTest
13
{
14
    /**
15
     * @covers MS\PHPMD\Rule\Test\MethodNumberOfMocks
16
     * @covers MS\PHPMD\Rule\Test\AbstractMethodNumberOf
17
     * @covers MS\PHPMD\Rule\Test\AbstractTestRule
18
     */
19 View Code Duplication
    public function testMoreMocks()
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...
20
    {
21
        $methodNode = $this->getMethodNode(
22
            self::CLASS_NAME,
23
            'testBar',
24
            ['MethodPostfix' => array_merge(
25
                array_fill(0, 3, $this->getNode('mock')),
26
                array_fill(0, 1, $this->getNode('getMock'))
27
            )]
28
        );
29
30
        $node = \Mockery::mock('PHPMD\Node\ClassNode');
31
        $node->shouldReceive('getImage')->andReturn(self::CLASS_NAME);
32
        $node->shouldReceive('getMethods')->andReturn([$methodNode]);
33
34
        $this->assertRule($node, 1);
35
    }
36
37
    /**
38
     * @return MethodNumberOfMocks
39
     */
40
    protected function getRule()
41
    {
42
        $rule =  new MethodNumberOfMocks();
43
        $rule->addProperty('number', '3');
44
        $rule->addProperty('names', 'getMock,mock');
45
        $rule->addProperty('delimiter', ',');
46
        $rule->addProperty('match', '1');
47
48
        return $rule;
49
    }
50
}
51