Skip to content

Commit

Permalink
Added test case for the new exceptions setting in ShortMethodName
Browse files Browse the repository at this point in the history
  • Loading branch information
ravage84 committed Oct 10, 2014
1 parent 84eabd9 commit 55b799b
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
20 changes: 20 additions & 0 deletions src/test/php/PHPMD/Rule/Naming/ShortMethodNameTest.php
Expand Up @@ -67,6 +67,7 @@ public function testRuleAppliesToFunctionWithNameShorterThanThreshold()
{
$rule = new ShortMethodName();
$rule->addProperty('minimum', 54);
$rule->addProperty('exceptions', '');
$rule->setReport($this->getReportMock(1));
$rule->apply($this->getFunction());
}
Expand All @@ -80,6 +81,7 @@ public function testRuleNotAppliesToFunctionWithNameEqualToThreshold()
{
$rule = new ShortMethodName();
$rule->addProperty('minimum', 52);
$rule->addProperty('exceptions', '');
$rule->setReport($this->getReportMock(0));
$rule->apply($this->getFunction());
}
Expand All @@ -93,6 +95,7 @@ public function testRuleNotAppliesToFunctionWithNameLongerThanThreshold()
{
$rule = new ShortMethodName();
$rule->addProperty('minimum', 54);
$rule->addProperty('exceptions', '');
$rule->setReport($this->getReportMock(0));
$rule->apply($this->getFunction());
}
Expand All @@ -105,6 +108,7 @@ public function testRuleAppliesToMethodWithNameShorterThanThreshold()
{
$rule = new ShortMethodName();
$rule->addProperty('minimum', 52);
$rule->addProperty('exceptions', '');
$rule->setReport($this->getReportMock(1));
$rule->apply($this->getMethod());
}
Expand All @@ -118,6 +122,7 @@ public function testRuleNotAppliesToMethodWithNameEqualToThreshold()
{
$rule = new ShortMethodName();
$rule->addProperty('minimum', 50);
$rule->addProperty('exceptions', '');
$rule->setReport($this->getReportMock(0));
$rule->apply($this->getMethod());
}
Expand All @@ -131,6 +136,21 @@ public function testRuleNotAppliesToMethodWithNameLongerThanThreshold()
{
$rule = new ShortMethodName();
$rule->addProperty('minimum', 52);
$rule->addProperty('exceptions', '');
$rule->setReport($this->getReportMock(0));
$rule->apply($this->getMethod());
}

/**
* testRuleNotAppliesToMethodWithNameLongerThanThreshold
*
* @return void
*/
public function testRuleNotAppliesToMethodWithShortNameWhenException()
{
$rule = new ShortMethodName();
$rule->addProperty('minimum', 100);
$rule->addProperty('exceptions', 'testRuleNotAppliesToMethodWithShortNameWhenException,another');
$rule->setReport($this->getReportMock(0));
$rule->apply($this->getMethod());
}
Expand Down
@@ -0,0 +1,8 @@
<?php
class testRuleNotAppliesToMethodWithShortNameWhenException
{
public function testRuleNotAppliesToMethodWithShortNameWhenException()
{

}
}

0 comments on commit 55b799b

Please sign in to comment.