|
1 |
| -.PHONY: debug run full-test-phpunit regression-test-phpunit |
2 |
| - |
3 | 1 | XDEBUG_OPTIONS=-dxdebug.remote_enable=1 -dxdebug.remote_autostart=1 -dxdebug.remote_host="host.docker.internal" -dxdebug.idekey=IDEKEY -dxdebug.remote_port=9008
|
4 |
| - |
5 |
| -debug: |
6 |
| - docker-compose run php php $(XDEBUG_OPTIONS) bin/regrest $(command) |
7 |
| - |
8 |
| -run: |
9 |
| - @docker-compose run php php bin/regrest $(command) |
10 |
| - |
| 2 | +PHP=docker-compose run php php |
11 | 3 | PHPUNIT_ROOT=test/Fixtures/PhpProjectUsingPhpunit
|
12 | 4 |
|
13 |
| -# generates coverage report |
14 |
| -full-test-phpunit: |
15 |
| - docker-compose run php php $(PHPUNIT_ROOT)/vendor/bin/phpunit --debug --colors=always --bootstrap $(PHPUNIT_ROOT)/vendor/autoload.php --coverage-filter=$(PHPUNIT_ROOT)/src --coverage-php=$(PHPUNIT_ROOT)/test/output/coverage.php --coverage-html=$(PHPUNIT_ROOT)/test/output/coverage.html $(PHPUNIT_ROOT)/test |
16 |
| - |
17 |
| -# does not generate coverage |
18 |
| -regression-test-phpunit: # one needs to pass output of regrest command to `options` argument |
19 |
| - docker-compose run php php $(PHPUNIT_ROOT)/vendor/bin/phpunit --debug --colors=always --bootstrap $(PHPUNIT_ROOT)/vendor/autoload.php --coverage-filter=$(PHPUNIT_ROOT)/src $(options) $(PHPUNIT_ROOT)/test |
20 |
| - |
21 |
| -full-regrest-demo: |
22 |
| - $(eval FILTER := $(shell make run command="regrest --changed-since=master --coverage-file=test/Fixtures/PhpProjectUsingPhpunit/test/output/coverage.php --framework=phpunit")) |
23 |
| - @echo '.' |
24 |
| - make inception-echo argument="--filter option for PHPUnit: '$(FILTER)'" |
25 |
| - @echo '.' |
26 |
| - make regression-test-phpunit options="--filter '$(FILTER)'"; |
27 |
| - |
28 |
| - |
29 |
| -.PHONY: inseption-echo |
30 |
| -inception-echo: |
31 |
| - echo $(argument) |
| 5 | +.PHONY: run |
| 6 | +run: |
| 7 | + @${PHP} bin/regrest $(command) |
32 | 8 |
|
33 |
| -#FILTER=`make run command="regrest --changed-since=master --coverage-file=test/Fixtures/PhpProjectUsingPhpunit/test/output/coverage.php --framework=phpunit"`; |
34 |
| -#make regression-test-phpunit options="--filter '$FILTER'"; |
| 9 | +.PHONY: debug |
| 10 | +debug: |
| 11 | + ${PHP} $(XDEBUG_OPTIONS) bin/regrest $(command) |
| 12 | + |
| 13 | +# test regrest <-> PHPUnit, step 1: generate coverage report in .php format |
| 14 | +.PHONY: generate-coverage-report-phpunit |
| 15 | +generate-coverage-report-phpunit: |
| 16 | + ${PHP} $(PHPUNIT_ROOT)/vendor/bin/phpunit --debug --colors=always --bootstrap $(PHPUNIT_ROOT)/vendor/autoload.php --coverage-filter=$(PHPUNIT_ROOT)/src --coverage-php=$(PHPUNIT_ROOT)/test/output/coverage.php --coverage-html=$(PHPUNIT_ROOT)/test/output/coverage.html $(PHPUNIT_ROOT)/test |
| 17 | + |
| 18 | +# change .php code under test/Fixtures/PhpProjectUsingPhpunit/src, otherwise regrest will report NOTHING_TO_RUN |
| 19 | + |
| 20 | +# test regrest <-> PHPUnit, step 2: let regrest generate PHPUnit's `--filter` option to run "meaningful" tests only |
| 21 | +.PHONY: run-regrest-phpunit |
| 22 | +run-regrest-phpunit: |
| 23 | + @${MAKE} run command="regrest --changed-since=master --coverage-file=test/Fixtures/PhpProjectUsingPhpunit/test/output/coverage.php --framework=phpunit" |
| 24 | + |
| 25 | +# test regrest <-> PHPUnit, step 3: run PHPUnit test suite with populated `--filter` option, so only the tiny portion of all tests is executed. |
| 26 | +.PHONY: run-test-suite-with-regrest-phpunit |
| 27 | +run-test-suite-with-regrest-phpunit: |
| 28 | + @echo "Run the following command:" |
| 29 | +# fish shell |
| 30 | + @echo make regression-test-phpunit options=--filter=\"\(make run-regrest-phpunit\)\" |
| 31 | + |
| 32 | +# Regular PHPUnit test suite run <-- this command relates to one from userland Makefile |
| 33 | +.PHONY: regression-test-phpunit |
| 34 | +regression-test-phpunit: |
| 35 | + ${PHP} $(PHPUNIT_ROOT)/vendor/bin/phpunit --debug --colors=always --bootstrap $(PHPUNIT_ROOT)/vendor/autoload.php --coverage-filter=$(PHPUNIT_ROOT)/src $(options) $(PHPUNIT_ROOT)/test |
0 commit comments