Skip to content

Commit

Permalink
Improve testability of rulesets
Browse files Browse the repository at this point in the history
By extracting the retrieval of the installed standards a third party ruleset/sniff developer, me, can easily create an extension of `AllSniffs` that only runs the sniffs of the ruleset in question.

This simple extraction will prevent doing cli magic like `--filter` and allow full configurability in a `phpunit.xml`

Adds to squizlabs#1756
  • Loading branch information
timoschinkel committed Feb 5, 2018
1 parent 2503b5a commit 22b6bfa
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion tests/Standards/AllSniffs.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public static function suite()
$ignoreTestsForStandards = explode(',', $ignoreTestsForStandards);
}

$installedStandards = Standards::getInstalledStandardDetails(true);
$installedStandards = self::getInstalledStandardDetails();

foreach ($installedStandards as $standard => $details) {
Autoload::addSearchPath($details['path'], $details['namespace']);
Expand Down Expand Up @@ -107,4 +107,17 @@ public static function suite()
}//end suite()


/**
* Get the details of all coding standards installed.
*
* @return array
* @see Standards::getInstalledStandardDetails()
*/
protected static function getInstalledStandardDetails()
{
return Standards::getInstalledStandardDetails(true);

}//end getInstalledStandardDetails()


}//end class

0 comments on commit 22b6bfa

Please sign in to comment.