Skip to content

Avoid printing a php notice for each issue #36

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 21, 2017
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);
}
}