diff --git a/Category.php b/Category.php index 0c45c77..1cb4a8c 100644 --- a/Category.php +++ b/Category.php @@ -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"; diff --git a/tests/CategoryTest.php b/tests/CategoryTest.php new file mode 100644 index 0000000..20ebd3e --- /dev/null +++ b/tests/CategoryTest.php @@ -0,0 +1,21 @@ +assertEquals("Security", $category); + } + + public function testDocumentationFor() + { + $documentation = Category::documentationFor("Design/EvalExpression"); + $this->assertContains("An eval-expression is untestable", $documentation); + } +}