| @@ 22-51 (lines=30) @@ | ||
| 19 | ||
| 20 | use PHPMD\AbstractTest; |
|
| 21 | ||
| 22 | class ElseExpressionTest extends AbstractTest |
|
| 23 | { |
|
| 24 | public function testRuleNotAppliesToMethodWithoutElseExpression() |
|
| 25 | { |
|
| 26 | $rule = new ElseExpression(); |
|
| 27 | $rule->setReport($this->getReportMock(0)); |
|
| 28 | $rule->apply($this->getMethod()); |
|
| 29 | } |
|
| 30 | ||
| 31 | public function testRuleAppliesToMethodWithElseExpression() |
|
| 32 | { |
|
| 33 | $rule = new ElseExpression(); |
|
| 34 | $rule->setReport($this->getReportMock(1)); |
|
| 35 | $rule->apply($this->getMethod()); |
|
| 36 | } |
|
| 37 | ||
| 38 | public function testRuleNotAppliesToGenerator() |
|
| 39 | { |
|
| 40 | $rule = new ElseExpression(); |
|
| 41 | $rule->setReport($this->getReportMock(0)); |
|
| 42 | $rule->apply($this->getMethod()); |
|
| 43 | } |
|
| 44 | ||
| 45 | public function testRuleAppliesMultipleTimesToMethodWithMultipleElseExpressions() |
|
| 46 | { |
|
| 47 | $rule = new ElseExpression(); |
|
| 48 | $rule->setReport($this->getReportMock(3)); |
|
| 49 | $rule->apply($this->getMethod()); |
|
| 50 | } |
|
| 51 | } |
|
| 52 | ||
| @@ 29-78 (lines=50) @@ | ||
| 26 | * |
|
| 27 | * @covers \PHPMD\Rule\Design\GotoStatement |
|
| 28 | */ |
|
| 29 | class GotoStatementTest extends AbstractTest |
|
| 30 | { |
|
| 31 | /** |
|
| 32 | * testRuleNotAppliesToMethodWithoutGotoStatement |
|
| 33 | * |
|
| 34 | * @return void |
|
| 35 | */ |
|
| 36 | public function testRuleNotAppliesToMethodWithoutGotoStatement() |
|
| 37 | { |
|
| 38 | $rule = new GotoStatement(); |
|
| 39 | $rule->setReport($this->getReportMock(0)); |
|
| 40 | $rule->apply($this->getMethod()); |
|
| 41 | } |
|
| 42 | ||
| 43 | /** |
|
| 44 | * testRuleAppliesToMethodWithGotoStatement |
|
| 45 | * |
|
| 46 | * @return void |
|
| 47 | */ |
|
| 48 | public function testRuleAppliesToMethodWithGotoStatement() |
|
| 49 | { |
|
| 50 | $rule = new GotoStatement(); |
|
| 51 | $rule->setReport($this->getReportMock(1)); |
|
| 52 | $rule->apply($this->getMethod()); |
|
| 53 | } |
|
| 54 | ||
| 55 | /** |
|
| 56 | * testRuleNotAppliesToFunctionWithoutGotoStatement |
|
| 57 | * |
|
| 58 | * @return void |
|
| 59 | */ |
|
| 60 | public function testRuleNotAppliesToFunctionWithoutGotoStatement() |
|
| 61 | { |
|
| 62 | $rule = new GotoStatement(); |
|
| 63 | $rule->setReport($this->getReportMock(0)); |
|
| 64 | $rule->apply($this->getFunction()); |
|
| 65 | } |
|
| 66 | ||
| 67 | /** |
|
| 68 | * testRuleAppliesToFunctionWithGotoStatement |
|
| 69 | * |
|
| 70 | * @return void |
|
| 71 | */ |
|
| 72 | public function testRuleAppliesToFunctionWithGotoStatement() |
|
| 73 | { |
|
| 74 | $rule = new GotoStatement(); |
|
| 75 | $rule->setReport($this->getReportMock(1)); |
|
| 76 | $rule->apply($this->getFunction()); |
|
| 77 | } |
|
| 78 | } |
|
| 79 | ||
| @@ 27-76 (lines=50) @@ | ||
| 24 | * |
|
| 25 | * @covers PHPMD\Rule\Naming\ConstantNamingConventions |
|
| 26 | */ |
|
| 27 | class ConstantNamingConventionsTest extends AbstractTest |
|
| 28 | { |
|
| 29 | /** |
|
| 30 | * testRuleAppliesToClassConstantWithLowerCaseCharacters |
|
| 31 | * |
|
| 32 | * @return void |
|
| 33 | */ |
|
| 34 | public function testRuleAppliesToClassConstantWithLowerCaseCharacters() |
|
| 35 | { |
|
| 36 | $rule = new ConstantNamingConventions(); |
|
| 37 | $rule->setReport($this->getReportMock(2)); |
|
| 38 | $rule->apply($this->getClass()); |
|
| 39 | } |
|
| 40 | ||
| 41 | /** |
|
| 42 | * testRuleAppliesToInterfaceConstantWithLowerCaseCharacters |
|
| 43 | * |
|
| 44 | * @return void |
|
| 45 | */ |
|
| 46 | public function testRuleAppliesToInterfaceConstantWithLowerCaseCharacters() |
|
| 47 | { |
|
| 48 | $rule = new ConstantNamingConventions(); |
|
| 49 | $rule->setReport($this->getReportMock(3)); |
|
| 50 | $rule->apply($this->getInterface()); |
|
| 51 | } |
|
| 52 | ||
| 53 | /** |
|
| 54 | * testRuleNotAppliesToClassConstantWithUpperCaseCharacters |
|
| 55 | * |
|
| 56 | * @return void |
|
| 57 | */ |
|
| 58 | public function testRuleNotAppliesToClassConstantWithUpperCaseCharacters() |
|
| 59 | { |
|
| 60 | $rule = new ConstantNamingConventions(); |
|
| 61 | $rule->setReport($this->getReportMock(0)); |
|
| 62 | $rule->apply($this->getClass()); |
|
| 63 | } |
|
| 64 | ||
| 65 | /** |
|
| 66 | * testRuleNotAppliesToInterfaceConstantWithUpperCaseCharacters |
|
| 67 | * |
|
| 68 | * @return void |
|
| 69 | */ |
|
| 70 | public function testRuleNotAppliesToInterfaceConstantWithUpperCaseCharacters() |
|
| 71 | { |
|
| 72 | $rule = new ConstantNamingConventions(); |
|
| 73 | $rule->setReport($this->getReportMock(0)); |
|
| 74 | $rule->apply($this->getInterface()); |
|
| 75 | } |
|
| 76 | } |
|
| 77 | ||