diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index 843ebe4cd5..b3c188fe5d 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -152,9 +152,8 @@ To help you with this, a number of convenience scripts are available: * `composer cs` will check for code style violations. * `composer cbf` will run the autofixers for code style violations. * `composer test` will run the unit tests. -* `composer coverage` will run the unit tests with code coverage. - Note: you may want to use a custom `phpunit.xml` overload config file to tell PHPUnit where to place an HTML report. - Alternative run it like so: `composer coverage -- --coverage-html /path/to/report-dir/` to specify the location for the HTML report on the command line. +* `composer coverage` will run the unit tests with code coverage and show a text summary. +* `composer coverage-local` will run the unit tests with code coverage and generate an HTML coverage report, which will be placed in a `build/coverage-html` subdirectory. * `composer build` will build the phpcs.phar and phpcbf.phar files. N.B.: You can ignore any skipped tests as these are for external tools. diff --git a/.gitignore b/.gitignore index a6c95c29f6..686e77608f 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,7 @@ /phpcs.xml /phpunit.xml .phpunit.result.cache +/build/ .idea/* /vendor/ composer.lock diff --git a/composer.json b/composer.json index 1b18633fb6..c0d0e4e082 100644 --- a/composer.json +++ b/composer.json @@ -62,6 +62,10 @@ "Composer\\Config::disableProcessTimeout", "@php ./vendor/phpunit/phpunit/phpunit tests/AllTests.php -d max_execution_time=0" ], + "coverage-local": [ + "Composer\\Config::disableProcessTimeout", + "@php ./vendor/phpunit/phpunit/phpunit tests/AllTests.php --coverage-html ./build/coverage-html -d max_execution_time=0" + ], "build": [ "Composer\\Config::disableProcessTimeout", "@php -d phar.readonly=0 -f ./scripts/build-phar.php" @@ -76,6 +80,7 @@ "cbf": "Fix code style violations.", "test": "Run the unit tests without code coverage.", "coverage": "Run the unit tests with code coverage.", + "coverage-local": "Run the unit tests with code coverage and generate an HTML report in a 'build' directory.", "build": "Create PHAR files for PHPCS and PHPCBF.", "check-all": "Run all checks (phpcs, tests)." } diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 68b5bac47f..9fb6c304db 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -9,10 +9,26 @@ convertWarningsToExceptions="true" convertNoticesToExceptions="true" convertDeprecationsToExceptions="true" + forceCoversAnnotation="true" > tests/AllTests.php + + + + ./src + ./autoload.php + + ./src/Standards + + + + + + + +