Skip to content

Latest commit

 

History

History
70 lines (38 loc) · 1.83 KB

CONTRIBUTING.md

File metadata and controls

70 lines (38 loc) · 1.83 KB

Contributing

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.

Setup

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.

Coding Standard

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

Tests

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

Static analysis

We use PHPStan and Phan, please refer to the respective documentation for installation instructions.

./vendor/bin/phpstan analyse
./vendor/bin/phan -i

Code Coverage

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.