MethodNumberOfTest::testMethodNumberOfRule()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 6
nc 1
nop 0
dl 0
loc 9
rs 9.6666
c 0
b 0
f 0
1
<?php
2
3
namespace MS\PHPMD\Tests\Functional\Test;
4
5
use MS\PHPMD\Tests\Functional\AbstractProcessTest;
6
7
/**
8
 * Class MethodNumberOfTest
9
 *
10
 * @package MS\PHPMD\Tests\Functional\Test
11
 */
12
class MethodNumberOfTest extends AbstractProcessTest
13
{
14
    /**
15
     * @covers MS\PHPMD\Rule\Test\MethodNumberOfAsserts
16
     * @covers MS\PHPMD\Rule\Test\MethodNumberOfMocks
17
     * @covers MS\PHPMD\Rule\Test\AbstractMethodNumberOf
18
     * @covers MS\PHPMD\Rule\Test\AbstractTestRule
19
     */
20
    public function testMethodNumberOfRule()
21
    {
22
        $output = $this
23
            ->runPhpmd('Tests/Test.php', 'test.xml')
24
            ->getOutput();
25
26
        $this->assertContains('Tests/Test.php:37	4 mocks are found in this test. Try to reduce the mocks to 3 or less.', $output);
27
        $this->assertContains('Tests/Test.php:52	6 asserts are found in this test. Try to reduce the asserts to 5 or less.', $output);
28
    }
29
30
    /**
31
     * @covers MS\PHPMD\Rule\Test\MethodNumberOfAsserts
32
     * @covers MS\PHPMD\Rule\Test\MethodNumberOfMocks
33
     * @covers MS\PHPMD\Rule\Test\AbstractMethodNumberOf
34
     * @covers MS\PHPMD\Rule\Test\AbstractTestRule
35
     */
36
    public function testRuleNoTest()
37
    {
38
        $output = $this
39
            ->runPhpmd('Entity/Entity.php', 'test.xml')
40
            ->getOutput();
41
42
        $this->assertEmpty(trim($output));
43
    }
44
}
45