If you contribute code, please make sure it conforms to the MO4 coding standard and that the unit tests still pass. Whenever possible, add an auto fixer for coding standard violations.
We do recommend the following setup:
-
make sure that Composer is installed
-
clone this repository
git clone https://github.com/mayflower/mo4-coding-standard.git
-
install all required dependencies
composer install
-
be sure that Xdebug is installed, if you like to check code coverage.
To check the coding standard, execute in the repository root:
./vendor/bin/phpcs
phpcs
might report that some coding standard issues can be fixed automatically.
So give phpcbf
a try and let it fix the issues for you:
./vendor/bin/phpcbf
To run the unit tests, execute in the repository root:
./vendor/bin/phpunit
To run the integration tests, execute
./vendor/bin/phpcs --standard=MO4 integrationtests/*.php
We use PHPStan and Phan, please refer to the respective documentation for installation instructions.
./vendor/bin/phpstan analyse
./vendor/bin/phan -i
Make sure, that you write tests for your code.
Testing code coverage with PHPUnit requires Xdebug to be enabled.
You can generate a simple code coverage report by running in the repository root:
./vendor/bin/phpunit --coverage-text
In the case that Xdebug is disabled by default
php -d zend_extension=xdebug.so vendor/bin/phpunit --coverage-text
will do the trick.
Please refer to the PHPUnit Manual for further information about code coverage.