Skip to content

Commit

Permalink
skip test-only use-cases when no tests found in target-AddOn (#38)
Browse files Browse the repository at this point in the history
  • Loading branch information
staabm authored Mar 29, 2023
1 parent 0e8277d commit 3280b15
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 10 deletions.
2 changes: 1 addition & 1 deletion lib/RexFactor.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ final class RexFactor {
private const PHP_MIGRATIONS = 'PHP Version Migrations';
private const CODE_QUALITY = 'Improve Code Quality';
public const PHPUNIT_MIGRATIONS = 'PHPUnit Version Migrations';
private const TESTS_QUALITY = 'Improve Test-Code Quality';
public const TESTS_QUALITY = 'Improve Test-Code Quality';
private const MISC_MIGRATIONS = 'Misc';
private const REX_CODE_STYLE_SETNAME = 'REX_CODE_STYLE';
private const USE_CASES = [
Expand Down
3 changes: 1 addition & 2 deletions pages/target-chooser.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,13 @@
}
}

$buttonType = 'btn-save';
$buttonLabel = $availableAddon->getName();
if ($buttonLabel === 'developer') {
$buttonLabel .= ' modules/templates';
}

echo '<li>
<a class="btn '. $buttonType .'" href="'.$useCaseUrl.'&addon='.$availableAddon->getName().'">'.$buttonLabel.'</a>
<a class="btn btn-save" href="'.$useCaseUrl.'&addon='.$availableAddon->getName().'">'.$buttonLabel.'</a>
'.implode(' ', $batches).'
</li>';
}
Expand Down
14 changes: 7 additions & 7 deletions pages/use-case.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

use rexfactor\RexFactor;

$addon = rex_get('addon', 'string');

$backUrl = rex_url::backendPage('rexfactor/target-chooser');
Expand All @@ -12,19 +14,17 @@
echo '<p>AddOn: '. rex_escape($addon) .'</p>';

echo '<ul>';
foreach(\rexfactor\RexFactor::getUseCases() as $groupLabel => $groupSetLists) {
foreach(RexFactor::getUseCases() as $groupLabel => $groupSetLists) {
if (in_array($groupLabel, [RexFactor::PHPUNIT_MIGRATIONS, RexFactor::TESTS_QUALITY], true) && !$hasTests) {
continue;
}

echo '<li>'.rex_escape($groupLabel).'</li>';

$buttonType = 'btn-save';
if ($groupLabel === \rexfactor\RexFactor::PHPUNIT_MIGRATIONS && !$hasTests) {
$buttonType = 'btn-default';
}

echo '<ul>';
foreach($groupSetLists as $setList => $label) {
$loader = \rexfactor\ViewHelpers::jsLoader();
echo '<li><a class="btn '. $buttonType .'" href="'.$previewUrl.'&set-list='.rex_escape($setList, 'url').'" onclick="'.$loader.'">'.rex_escape($label).'</a></li>';
echo '<li><a class="btn btn-save" href="'.$previewUrl.'&set-list='.rex_escape($setList, 'url').'" onclick="'.$loader.'">'.rex_escape($label).'</a></li>';
}
echo '</ul>';
}
Expand Down

0 comments on commit 3280b15

Please sign in to comment.