Skip to content

Commit f97a0c1

Browse files
Merge pull request #62 from edmondscommerce/PhpUnitIterativeMode
Php unit iterative mode
2 parents 5d4a331 + 2e87584 commit f97a0c1

File tree

6 files changed

+19
-265
lines changed

6 files changed

+19
-265
lines changed

bin/phpunit-runfailed-filter

Lines changed: 0 additions & 30 deletions
This file was deleted.

docs/tools/phpunit.md

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,24 @@
22

33
Here is the full documentation about how you can use and configure PHPUnit in your PHPQA project.
44

5+
## Iterative Mode
6+
7+
When you have tests that are failing and you are working towards getting everything green, then you might want to try iterative mode.
8+
9+
The easiest way to do this is:
10+
11+
```bash
12+
./bin/qa -t uniterate
13+
```
14+
15+
This will run PHPunit in isolation
16+
17+
The first run will be a full run (unless you have done one previously)
18+
19+
Subsequent runs will then run your failed tests first and will stop on the first error.
20+
21+
This allows you to quickly iterate on your test suite and push it towards getting everything passing.
22+
523
## Quick Tests
624

725
There is an environment variable for PHPUnit set called `phpUnitQuickTests`
@@ -129,21 +147,6 @@ We suggest that you install [https://github.com/phpstan/phpstan-phpunit](https:/
129147

130148
Read the [PHPQA PHPStan docs](./phpstan.md) for more information on this.
131149

132-
133-
## Rerun Failed Tests
134-
135-
As with the other tools, there is an option to rerun this step if it fails.
136-
137-
Where PHPUnit is different is that you also get the option to only rerun your failed tests.
138-
139-
This uses another bin command [./bin/phpunit-runfailed-filter](./../../bin/phpunit-runfailed-filter) which generates the filter syntax to pull out the failed tests.
140-
141-
You can also use this in isolation if you want, eg:
142-
143-
```bash
144-
./bin/phpunit -c qaConfig/phpunit.xml --filter "$(bin/phpunit-runfailed-filter)" tests/
145-
```
146-
147150
## Infection
148151

149152
Another tool that runs your PHPUnit tests is Infection. This will only run if Xdebug is enabled and you have configured PHPUnit to generate coverage.

includes/generic/phpunit.inc.bash

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -22,20 +22,6 @@ phpunitExitCode=99
2222
phpunitLogFilePath="$varDir/phpunit_logs/phpunit.junit.xml"
2323
while (( phpunitExitCode > 0 ))
2424
do
25-
declare -a rerunFilter
26-
rerunFilter=(" ")
27-
# THIS ISNT WORKING AT THE MOMENT - COMMENTING OUT FOR NOW
28-
# if phpunitReRunFailedOrFull
29-
# then
30-
# #set no glob
31-
# set -f
32-
# rerunFilterPattern=$(phpNoXdebug bin/phpunit-runfailed-filter)
33-
# if [[ "$rerunFilterPattern" != '/.*/' ]]
34-
# then
35-
# rerunFilter+=( --filter $IFS $rerunFilterPattern)
36-
# phpunitFailedOnlyFiltered=1
37-
# fi
38-
# fi
3925
extraConfigs=(" ")
4026
if [[ "1" != "$phpUnitCoverage" ]]
4127
then
@@ -49,14 +35,14 @@ do
4935
echo
5036
extraConfigs+=( --order-by=depends,defects )
5137
extraConfigs+=( --stop-on-failure --stop-on-error --stop-on-defect --stop-on-warning )
38+
extraConfigs+=( --no-coverage )
5239
fi
5340
set +e
5441
set -x
5542
phpUnitQuickTests="$phpUnitQuickTests" $phpCmd -f $phpunitPath \
5643
-- \
5744
${paratestConfig[@]} \
5845
-c ${phpUnitConfigPath} \
59-
${rerunFilter[@]} \
6046
${extraConfigs[@]} \
6147
--enforce-time-limit \
6248
--fail-on-risky \

includes/generic/setConfig.inc.bash

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,6 @@ phpUnitQuickTests=${phpUnitQuickTests:-0}
4646
# if enabled, tests will run with Xdebug and generate coverage (which is a lot slower)
4747
phpUnitCoverage=${phpUnitCoverage:-1}
4848

49-
# How many minutes after a failed PHPUnit run you can retry failed only
50-
phpunitRerunTimeoutMins=${phpunitRerunTimeoutMins:-5}
51-
5249
# Can only generate coverage if Xdebug is enabled
5350
if [[ "1" != "$xdebugEnabled" ]]
5451
then

src/PHPUnit/RerunCommandGenerator.php

Lines changed: 0 additions & 131 deletions
This file was deleted.

tests/Small/PHPUnit/RerunCommandGeneratorTest.php

Lines changed: 0 additions & 71 deletions
This file was deleted.

0 commit comments

Comments
 (0)