Skip to content

Commit 5d4a331

Browse files
Merge pull request #61 from edmondscommerce/PhpUnitIterativeMode
Php unit iterative mode
2 parents ea70ca9 + 4d13427 commit 5d4a331

File tree

3 files changed

+17
-3
lines changed

3 files changed

+17
-3
lines changed

includes/generic/phpunit.inc.bash

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,19 @@ do
3636
# phpunitFailedOnlyFiltered=1
3737
# fi
3838
# fi
39-
noCoverage=(" ")
39+
extraConfigs=(" ")
4040
if [[ "1" != "$phpUnitCoverage" ]]
4141
then
42-
noCoverage+=( --no-coverage )
42+
extraConfigs+=( --no-coverage )
43+
fi
44+
if [[ "1" == "$phpUnitIterativeMode" ]]
45+
then
46+
echo
47+
echo "Uniterate Mode - Iterative Testing with Fast Failure"
48+
echo "----------------------------------------------------"
49+
echo
50+
extraConfigs+=( --order-by=depends,defects )
51+
extraConfigs+=( --stop-on-failure --stop-on-error --stop-on-defect --stop-on-warning )
4352
fi
4453
set +e
4554
set -x
@@ -48,7 +57,7 @@ do
4857
${paratestConfig[@]} \
4958
-c ${phpUnitConfigPath} \
5059
${rerunFilter[@]} \
51-
${noCoverage[@]} \
60+
${extraConfigs[@]} \
5261
--enforce-time-limit \
5362
--fail-on-risky \
5463
--fail-on-warning \

includes/generic/setConfig.inc.bash

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,9 @@ phpcsFailOnWarning=0
3636

3737
##PHPUnit Configs
3838

39+
#Iterative Mode - prioritises runnign failed tests and stops on first error
40+
phpUnitIterativeMode=${phpUnitIterativeMode:-0}
41+
3942
# PHPUnit Quick Tests - optional skip slow tests
4043
phpUnitQuickTests=${phpUnitQuickTests:-0}
4144

includes/options.inc.bash

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ function usage {
2828
echo " stan|phpstan phpstan"
2929
echo " ann|phpunitAnnotations phpunitAnnotations"
3030
echo " unit|phpunit phpunit"
31+
echo " uniterate phpunit iterative mode - prioritise broken tests and fail on error"
3132
echo " infect|infection infection"
3233
echo " md|messdetector php mess detector"
3334
echo " ml|markdown markdown validation"
@@ -63,6 +64,7 @@ then
6364
stan | phpstan ) singleToolToRun="phpstan";;
6465
ann | phpunitAnnotations ) singleToolToRun="phpunitAnnotations";;
6566
unit | phpunit ) singleToolToRun="phpunit";;
67+
uniterate ) singleToolToRun="phpunit"; phpUnitIterativeMode=1;;
6668
infect | infection ) singleToolToRun="infection";;
6769
md | messdetector ) singleToolToRun="messDetector";;
6870
ml | markdown ) singleToolToRun="markdownLinks";;

0 commit comments

Comments
 (0)