testRuleDoesNotApplyToClassesWithSameNumberOfFieldsAsThreshold()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 7

Duplication

Lines 7
Ratio 100 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 0
dl 7
loc 7
rs 10
c 0
b 0
f 0
1
<?php
2
/**
3
 * This file is part of PHP Mess Detector.
4
 *
5
 * Copyright (c) Manuel Pichler <[email protected]>.
6
 * All rights reserved.
7
 *
8
 * Licensed under BSD License
9
 * For full copyright and license information, please see the LICENSE file.
10
 * Redistributions of files must retain the above copyright notice.
11
 *
12
 * @author Manuel Pichler <[email protected]>
13
 * @copyright Manuel Pichler. All rights reserved.
14
 * @license https://opensource.org/licenses/bsd-license.php BSD License
15
 * @link http://phpmd.org/
16
 */
17
18
namespace PHPMD\Rule\Design;
19
20
use PHPMD\AbstractTest;
21
22
/**
23
 * Test case for the too many methods rule.
24
 *
25
 * @covers \PHPMD\Rule\Design\TooManyFields
26
 */
27 View Code Duplication
class TooManyFieldsTest extends AbstractTest
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...
28
{
29
    /**
30
     * testRuleDoesNotApplyToClassesWithLessFieldsThanThreshold
31
     *
32
     * @return void
33
     */
34
    public function testRuleDoesNotApplyToClassesWithLessFieldsThanThreshold()
35
    {
36
        $rule = new TooManyFields();
37
        $rule->setReport($this->getReportMock(0));
38
        $rule->addProperty('maxfields', '42');
39
        $rule->apply($this->getClassMock('vars', 23));
40
    }
41
42
    /**
43
     * testRuleDoesNotApplyToClassesWithSameNumberOfFieldsAsThreshold
44
     *
45
     * @return void
46
     */
47
    public function testRuleDoesNotApplyToClassesWithSameNumberOfFieldsAsThreshold()
48
    {
49
        $rule = new TooManyFields();
50
        $rule->setReport($this->getReportMock(0));
51
        $rule->addProperty('maxfields', '42');
52
        $rule->apply($this->getClassMock('vars', 42));
53
    }
54
55
    /**
56
     * testRuleAppliesToClassesWithMoreFieldsThanThreshold
57
     *
58
     * @return void
59
     */
60
    public function testRuleAppliesToClassesWithMoreFieldsThanThreshold()
61
    {
62
        $rule = new TooManyFields();
63
        $rule->setReport($this->getReportMock(1));
64
        $rule->addProperty('maxfields', '23');
65
        $rule->apply($this->getClassMock('vars', 42));
66
    }
67
}
68