Skip to content

Commit

Permalink
Merge pull request #61 from edmondscommerce/PhpUnitIterativeMode
Browse files Browse the repository at this point in the history
Php unit iterative mode
  • Loading branch information
Edmonds Commerce committed Aug 3, 2018
2 parents ea70ca9 + 4d13427 commit 5d4a331
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 3 deletions.
15 changes: 12 additions & 3 deletions includes/generic/phpunit.inc.bash
Expand Up @@ -36,10 +36,19 @@ do
# phpunitFailedOnlyFiltered=1
# fi
# fi
noCoverage=(" ")
extraConfigs=(" ")
if [[ "1" != "$phpUnitCoverage" ]]
then
noCoverage+=( --no-coverage )
extraConfigs+=( --no-coverage )
fi
if [[ "1" == "$phpUnitIterativeMode" ]]
then
echo
echo "Uniterate Mode - Iterative Testing with Fast Failure"
echo "----------------------------------------------------"
echo
extraConfigs+=( --order-by=depends,defects )
extraConfigs+=( --stop-on-failure --stop-on-error --stop-on-defect --stop-on-warning )
fi
set +e
set -x
Expand All @@ -48,7 +57,7 @@ do
${paratestConfig[@]} \
-c ${phpUnitConfigPath} \
${rerunFilter[@]} \
${noCoverage[@]} \
${extraConfigs[@]} \
--enforce-time-limit \
--fail-on-risky \
--fail-on-warning \
Expand Down
3 changes: 3 additions & 0 deletions includes/generic/setConfig.inc.bash
Expand Up @@ -36,6 +36,9 @@ phpcsFailOnWarning=0

##PHPUnit Configs

#Iterative Mode - prioritises runnign failed tests and stops on first error
phpUnitIterativeMode=${phpUnitIterativeMode:-0}

# PHPUnit Quick Tests - optional skip slow tests
phpUnitQuickTests=${phpUnitQuickTests:-0}

Expand Down
2 changes: 2 additions & 0 deletions includes/options.inc.bash
Expand Up @@ -28,6 +28,7 @@ function usage {
echo " stan|phpstan phpstan"
echo " ann|phpunitAnnotations phpunitAnnotations"
echo " unit|phpunit phpunit"
echo " uniterate phpunit iterative mode - prioritise broken tests and fail on error"
echo " infect|infection infection"
echo " md|messdetector php mess detector"
echo " ml|markdown markdown validation"
Expand Down Expand Up @@ -63,6 +64,7 @@ then
stan | phpstan ) singleToolToRun="phpstan";;
ann | phpunitAnnotations ) singleToolToRun="phpunitAnnotations";;
unit | phpunit ) singleToolToRun="phpunit";;
uniterate ) singleToolToRun="phpunit"; phpUnitIterativeMode=1;;
infect | infection ) singleToolToRun="infection";;
md | messdetector ) singleToolToRun="messDetector";;
ml | markdown ) singleToolToRun="markdownLinks";;
Expand Down

0 comments on commit 5d4a331

Please sign in to comment.