Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions Category.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,9 @@ public static function categoryFor($checkName)

public static function documentationFor($checkName)
{
$rule = array_pop(
explode("/", $checkName)
);
$checkNameParts = explode("/", $checkName);
end($checkNameParts);
$rule = array_pop($checkNameParts);

$filePath = dirname(__FILE__) . "/content/" . strtolower($rule) . ".txt";

Expand Down
21 changes: 21 additions & 0 deletions tests/CategoryTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?php

namespace PHPMD\Tests;

use PHPMD\Category\Category;

class CategoryTest extends \PHPUnit_Framework_TestCase
{

public function testCategoryFor()
{
$category = Category::categoryFor("Design/EvalExpression");
$this->assertEquals("Security", $category);
}

public function testDocumentationFor()
{
$documentation = Category::documentationFor("Design/EvalExpression");
$this->assertContains("An eval-expression is untestable", $documentation);
}
}