-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve test suite by adding "composer run multicover"
This will aid on running the tests with coverage on both PHP7 and PHP8, merge coverage reports and render them as HTML to be inspected by humans. It's not completely maintenance free because some paths will probably have to be adjusted for others, but it's way better than nothing.
- Loading branch information
Showing
3 changed files
with
79 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -81,15 +81,15 @@ Installation | |
|
||
Install prerequisites:: | ||
|
||
# Install different PHP releases. | ||
brew install [email protected] [email protected] [email protected] composer | ||
# Install different PHP releases and Composer. | ||
brew install [email protected] [email protected] [email protected] brew-php-switcher composer | ||
|
||
# Select PHP version. | ||
brew-php-switcher 7.3 | ||
brew-php-switcher 7.4 | ||
brew-php-switcher 8.0 | ||
|
||
# Install xdebug extension for tracking code coverage. | ||
# Install `xdebug` extension into each environment for tracking code coverage. | ||
pecl install xdebug | ||
|
||
Get the sources:: | ||
|
@@ -113,9 +113,19 @@ Running the Tests | |
--mount type=bind,source=$PWD/test/provisioning/truststore,target=/vagrant/test/provisioning/truststore \ | ||
--publish 4200:4200 --publish 5432:5432 crate/crate:nightly | ||
|
||
# Run test suite | ||
# Run test suite on current/default version of PHP | ||
composer run test | ||
|
||
# Run tests on both PHP7 and PHP8 to get the full picture of coverage | ||
composer run multicover | ||
open build/multicover/html/index.html | ||
|
||
|
||
Invoke code style checks | ||
======================== | ||
|
||
:: | ||
|
||
# Run code style checks | ||
composer run check-style | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
#!/bin/sh | ||
# | ||
# About | ||
# ===== | ||
# | ||
# Run tests with coverage on both PHP7 and PHP8, | ||
# merge coverage reports and render them as HTML. | ||
# | ||
# Please adjust the paths to the PHP interpreters | ||
# to fit your needs. Make sure to `pecl install xdebug` | ||
# in both PHP7 and PHP8 environments beforehand. | ||
# | ||
# Setup | ||
# ===== | ||
# | ||
# Install different PHP releases and Composer:: | ||
# | ||
# brew install [email protected] [email protected] [email protected] brew-php-switcher composer | ||
# | ||
# Select PHP version:: | ||
# | ||
# brew-php-switcher 7.3 | ||
# brew-php-switcher 7.4 | ||
# brew-php-switcher 8.0 | ||
# | ||
# Install `xdebug` extension into each environment for tracking code coverage:: | ||
# | ||
# pecl install xdebug | ||
# | ||
# Install `phpunit-merger`:: | ||
# | ||
# composer require --dev nimut/phpunit-merger | ||
# | ||
# Please make sure to remove it before committing as it is currently not available for PHP8:: | ||
# | ||
# composer remove --dev nimut/phpunit-merger | ||
# | ||
|
||
# Define shortcuts to executables. | ||
php7=/usr/local/Cellar/[email protected]/7.4.15/bin/php | ||
php8=/usr/local/Cellar/php/8.0.2/bin/php | ||
phpunit="$(pwd)/vendor/bin/phpunit" | ||
phpunit_merger="$(pwd)/vendor/bin/phpunit-merger" | ||
|
||
# Prepare output directories. | ||
mkdir -p build/multicover/reports build/multicover/html | ||
rm -rf build/multicover/reports/* build/multicover/html/* | ||
|
||
# Enable coverage tracing. | ||
export XDEBUG_MODE=coverage | ||
|
||
# Run tests with PHP coverage output on both PHP7 and PHP8. | ||
echo Running tests with coverage on PHP7 | ||
$php7 $phpunit --coverage-php build/multicover/reports/clover-php7.php | ||
echo; echo | ||
|
||
echo Running tests with coverage on PHP8 | ||
$php8 $phpunit --coverage-php build/multicover/reports/clover-php8.php | ||
echo; echo | ||
|
||
# Merge coverage reports and generate HTML output. | ||
echo Merging test reports | ||
$php7 $phpunit_merger coverage build/multicover/reports --html=build/multicover/html /dev/null |