Skip to content

Commit 3749c1c

Browse files
authored
Re-use coverage (#187)
Tweak the Makefile rules to run the same tests twice
1 parent 4e436f8 commit 3749c1c

File tree

3 files changed

+10
-9
lines changed

3 files changed

+10
-9
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
/bin/php-scoper.phar*.pubkey
44
/box.json
55
/build/
6+
/clover.xml
67
/dist/
78
/fixtures/set004/scoper.inc.php
89
/fixtures/*/vendor

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ script:
3434
make tc
3535
make e2e
3636
else
37-
make tm
37+
make tu
3838
fi
3939
4040
deploy:

Makefile

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ build: bin/php-scoper src vendor vendor-bin/box/vendor scoper.inc.php box.json
4848
##---------------------------------------------------------------------------
4949

5050
test: ## Run all the tests
51-
test: tu e2e
51+
test: tc e2e
5252

5353
tu: ## Run PHPUnit tests
5454
tu: vendor/bin/phpunit
@@ -57,7 +57,9 @@ tu: vendor/bin/phpunit
5757
tc: ## Run PHPUnit tests with test coverage
5858
tc: vendor/bin/phpunit vendor-bin/covers-validator/vendor
5959
$(COVERS_VALIDATOR)
60-
phpdbg -qrr -d zend.enable_gc=0 $(PHPUNIT) --coverage-html=dist/coverage --coverage-text
60+
phpdbg -qrr -d zend.enable_gc=0 $(PHPUNIT) --coverage-html=dist/coverage --coverage-text --coverage-clover=clover.xml --coverage-xml=dist/infection-coverage/coverage-xml --log-junit=dist/infection-coverage/phpunit.junit.xml
61+
62+
php -d zend.enable_gc=0 $(PHPUNIT)
6163

6264
tm: ## Run Infection (Mutation Testing)
6365
tm: vendor/bin/phpunit
@@ -152,18 +154,13 @@ e2e_019: bin/php-scoper.phar fixtures/set019-symfony-console/vendor
152154
diff fixtures/set019-symfony-console/expected-output build/set019-symfony-console/output
153155

154156
e2e_020: ## Run end-to-end tests for the fixture set 020: Infection
155-
e2e_020: bin/php-scoper.phar fixtures/set020-infection/vendor
157+
e2e_020: bin/php-scoper.phar fixtures/set020-infection/vendor clover.xml
156158
php -d zend.enable_gc=0 $(PHPSCOPER) add-prefix --working-dir=fixtures/set020-infection --output-dir=../../build/set020-infection --force --no-interaction --stop-on-failure
157159
composer --working-dir=build/set020-infection dump-autoload
158160

159-
# Create coverage reports to be able to run Infection without running the tests
160-
php -d zend.enable_gc=0 $(PHPUNIT) --coverage-clover=clover.xml --coverage-xml=dist/infection-coverage/coverage-xml --log-junit=dist/infection-coverage/phpunit.junit.xml
161-
162161
php fixtures/set020-infection/vendor/infection/infection/bin/infection --coverage=dist/infection-coverage > build/set020-infection/expected-output
163162
php build/set020-infection/vendor/infection/infection/bin/infection --coverage=dist/infection-coverage > build/set020-infection/output
164163

165-
rm clover.xml
166-
167164
diff build/set020-infection/expected-output build/set020-infection/output
168165

169166
tb: ## Run Blackfire profiling
@@ -257,3 +254,6 @@ bin/php-scoper.phar: bin/php-scoper src vendor vendor-bin/box/vendor scoper.inc.
257254

258255
box.json:
259256
cat box.json.dist | sed -E 's/\"key\": \".+\",//g' | sed -E 's/\"algorithm\": \".+\",//g' > box.json
257+
258+
clover.xml: src
259+
$(MAKE) tc

0 commit comments

Comments
 (0)