| @@ 34-41 (lines=8) @@ | ||
| 31 | * |
|
| 32 | * @return void |
|
| 33 | */ |
|
| 34 | public function testRuleAppliesToFunctionWithNameShorterThanThreshold() |
|
| 35 | { |
|
| 36 | $rule = new ShortMethodName(); |
|
| 37 | $rule->addProperty('minimum', 54); |
|
| 38 | $rule->addProperty('exceptions', ''); |
|
| 39 | $rule->setReport($this->getReportMock(1)); |
|
| 40 | $rule->apply($this->getFunction()); |
|
| 41 | } |
|
| 42 | ||
| 43 | /** |
|
| 44 | * testRuleNotAppliesToFunctionWithNameEqualToThreshold |
|
| @@ 48-55 (lines=8) @@ | ||
| 45 | * |
|
| 46 | * @return void |
|
| 47 | */ |
|
| 48 | public function testRuleNotAppliesToFunctionWithNameEqualToThreshold() |
|
| 49 | { |
|
| 50 | $rule = new ShortMethodName(); |
|
| 51 | $rule->addProperty('minimum', 52); |
|
| 52 | $rule->addProperty('exceptions', ''); |
|
| 53 | $rule->setReport($this->getReportMock(0)); |
|
| 54 | $rule->apply($this->getFunction()); |
|
| 55 | } |
|
| 56 | ||
| 57 | /** |
|
| 58 | * testRuleNotAppliesToFunctionWithNameLongerThanThreshold |
|
| @@ 62-69 (lines=8) @@ | ||
| 59 | * |
|
| 60 | * @return void |
|
| 61 | */ |
|
| 62 | public function testRuleNotAppliesToFunctionWithNameLongerThanThreshold() |
|
| 63 | { |
|
| 64 | $rule = new ShortMethodName(); |
|
| 65 | $rule->addProperty('minimum', 54); |
|
| 66 | $rule->addProperty('exceptions', ''); |
|
| 67 | $rule->setReport($this->getReportMock(0)); |
|
| 68 | $rule->apply($this->getFunction()); |
|
| 69 | } |
|
| 70 | /** |
|
| 71 | * testRuleAppliesToFunctionWithNameShorterThanThreshold |
|
| 72 | * |
|
| @@ 75-82 (lines=8) @@ | ||
| 72 | * |
|
| 73 | * @return void |
|
| 74 | */ |
|
| 75 | public function testRuleAppliesToMethodWithNameShorterThanThreshold() |
|
| 76 | { |
|
| 77 | $rule = new ShortMethodName(); |
|
| 78 | $rule->addProperty('minimum', 52); |
|
| 79 | $rule->addProperty('exceptions', ''); |
|
| 80 | $rule->setReport($this->getReportMock(1)); |
|
| 81 | $rule->apply($this->getMethod()); |
|
| 82 | } |
|
| 83 | ||
| 84 | /** |
|
| 85 | * testRuleNotAppliesToMethodWithNameEqualToThreshold |
|
| @@ 89-96 (lines=8) @@ | ||
| 86 | * |
|
| 87 | * @return void |
|
| 88 | */ |
|
| 89 | public function testRuleNotAppliesToMethodWithNameEqualToThreshold() |
|
| 90 | { |
|
| 91 | $rule = new ShortMethodName(); |
|
| 92 | $rule->addProperty('minimum', 50); |
|
| 93 | $rule->addProperty('exceptions', ''); |
|
| 94 | $rule->setReport($this->getReportMock(0)); |
|
| 95 | $rule->apply($this->getMethod()); |
|
| 96 | } |
|
| 97 | ||
| 98 | /** |
|
| 99 | * testRuleNotAppliesToMethodWithNameLongerThanThreshold |
|
| @@ 103-110 (lines=8) @@ | ||
| 100 | * |
|
| 101 | * @return void |
|
| 102 | */ |
|
| 103 | public function testRuleNotAppliesToMethodWithNameLongerThanThreshold() |
|
| 104 | { |
|
| 105 | $rule = new ShortMethodName(); |
|
| 106 | $rule->addProperty('minimum', 52); |
|
| 107 | $rule->addProperty('exceptions', ''); |
|
| 108 | $rule->setReport($this->getReportMock(0)); |
|
| 109 | $rule->apply($this->getMethod()); |
|
| 110 | } |
|
| 111 | ||
| 112 | /** |
|
| 113 | * testRuleNotAppliesToMethodWithNameLongerThanThreshold |
|
| @@ 117-124 (lines=8) @@ | ||
| 114 | * |
|
| 115 | * @return void |
|
| 116 | */ |
|
| 117 | public function testRuleNotAppliesToMethodWithShortNameWhenException() |
|
| 118 | { |
|
| 119 | $rule = new ShortMethodName(); |
|
| 120 | $rule->addProperty('minimum', 100); |
|
| 121 | $rule->addProperty('exceptions', 'testRuleNotAppliesToMethodWithShortNameWhenException,another'); |
|
| 122 | $rule->setReport($this->getReportMock(0)); |
|
| 123 | $rule->apply($this->getMethod()); |
|
| 124 | } |
|
| 125 | ||
| 126 | /** |
|
| 127 | * testRuleAlsoWorksWithoutExceptionListConfigured |
|
| @@ 134-140 (lines=7) @@ | ||
| 131 | * @link https://github.com/phpmd/phpmd/issues/80 |
|
| 132 | * @link https://github.com/phpmd/phpmd/issues/270 |
|
| 133 | */ |
|
| 134 | public function testRuleAlsoWorksWithoutExceptionListConfigured() |
|
| 135 | { |
|
| 136 | $rule = new ShortMethodName(); |
|
| 137 | $rule->addProperty('minimum', 100); |
|
| 138 | $rule->setReport($this->getReportMock(0)); |
|
| 139 | $rule->apply($this->getMethodMock()); |
|
| 140 | } |
|
| 141 | } |
|
| 142 | ||