Skip to content

Commit

Permalink
Enhance tests of order of phpdoc fixers
Browse files Browse the repository at this point in the history
  • Loading branch information
keradus authored and GrahamCampbell committed Feb 18, 2015
1 parent 9f3aab8 commit 0006059
Showing 1 changed file with 32 additions and 8 deletions.
40 changes: 32 additions & 8 deletions Symfony/CS/Tests/FixerTest.php
Expand Up @@ -166,7 +166,7 @@ public function getFixersPriorityCases()
$fixers[$fixer->getName()] = $fixer;
}

return array(
$cases = array(
array($fixers['php_closing_tag'], $fixers['short_tag']),
array($fixers['unused_use'], $fixers['extra_empty_lines']),
array($fixers['multiple_use'], $fixers['unused_use']),
Expand All @@ -188,14 +188,38 @@ public function getFixersPriorityCases()
array($fixers['phpdoc_no_empty_return'], $fixers['phpdoc_order']),
array($fixers['phpdoc_no_package'], $fixers['phpdoc_separation']),
array($fixers['phpdoc_no_package'], $fixers['phpdoc_order']),
array($fixers['phpdoc_trim'], $fixers['phpdoc_params']),
array($fixers['phpdoc_order'], $fixers['phpdoc_params']),
array($fixers['phpdoc_no_empty_return'], $fixers['phpdoc_params']),
array($fixers['phpdoc_indent'], $fixers['phpdoc_params']),
array($fixers['phpdoc_to_comment'], $fixers['phpdoc_params']),
array($fixers['phpdoc_to_comment'], $fixers['phpdoc_indent']),
array($fixers['phpdoc_to_comment'], $fixers['no_empty_lines_after_phpdocs']),
array($fixers['phpdoc_no_empty_return'], $fixers['phpdoc_trim']),
array($fixers['phpdoc_no_package'], $fixers['phpdoc_trim']),
array($fixers['phpdoc_separation'], $fixers['phpdoc_trim']),
array($fixers['phpdoc_short_description'], $fixers['phpdoc_trim']),
array($fixers['phpdoc_var_without_name'], $fixers['phpdoc_trim']),
array($fixers['phpdoc_order'], $fixers['phpdoc_trim']),
);

$docFixerNames = array_filter(
array_keys($fixers),
function ($name) {
return false !== strpos($name, 'phpdoc');
}
);

// prepare bulk tests for phpdoc fixers to test if:
// * `phpdoc_to_comment` is first
// * `phpdoc_indent` is second
// * `phpdoc_params` is last
$cases[] = array($fixers['phpdoc_to_comment'], $fixers['phpdoc_indent']);
foreach ($docFixerNames as $docFixerName) {
if (!in_array($docFixerName, array('phpdoc_to_comment', 'phpdoc_indent'), true)) {
$cases[] = array($fixers['phpdoc_to_comment'], $fixers[$docFixerName]);
$cases[] = array($fixers['phpdoc_indent'], $fixers[$docFixerName]);
}

if ('phpdoc_params' !== $docFixerName) {
$cases[] = array($fixers[$docFixerName], $fixers['phpdoc_params']);
}
}

return $cases;
}

public static function getFixerLevels()
Expand Down

0 comments on commit 0006059

Please sign in to comment.