How to contribute
Your are welcome to contribute to the project by simply posting issues or by providing pull resquests.
Each time you provide a pull request to fix bugs or propose an evolution you MUST adhere to the conventions and best practices described here.
Always create PRs on the develop
branch
The project is hosted on Github using 2 branches :
-
develop
: This branch MUST BE used to create Pull Requests -
master
: This branch MUST NEVER BE used directly to create Pull Requests and is maintained by GoMoob
All Pull Requests created using the master branch will be rejected.
Coding conventions
Formatting
The source code MUST BE compliant with the following PSRs :
If you provide a Pull Request with source code which is not compliant with those 2 standards the CI build will fail.
To check if your code is compliant with PSR-1 and PSR-2 a Grunt build command which uses PHP_CodeSniffer is provided with the project, ALWAYS execute it before commiting your changes.
Sometimes this command will output a lot of errors, an other Grunt command is provided to automatically fix the most
common errors (this command uses the
PHP_CodeSniffer phpcbf
tool
).
Unit tests
The unit tests of the project are executed using PHPUnit, the main
code has to be placed inside the src/main/php
directory, the test code has to be placed inside the
src/test/php
directory.
Each class which is tested is named using a clearly defined convention, for example the class
Gomoob\Pushwoosh\Model\Request\CreateMessageRequest
which is placed in the
src/main/php
directory is tested using a class named
GoMoob\Pushwoosh\Model\Request\CreateMessageRequestTest
placed in the src/test/php
directory.
A test class MUST have the same PHP namespace as the class it tests.
Build scripts
The build scripts of the project are managed using the Grunt build tool.
To execute the builds first install Grunt (which needs NodeJS) and then pull the Node dependencies / Grunt plugins required by the Gruntfile build script.
Then install Composer and executes the following command to
pull the PHP dependencies required (in fact this is onlye necessary to generate the vendor/autoload.php
file required for the PHP classes autoloading).
Default build task
The default build task cleans the temporary target
directory of the project, executes the unit tests
and generates the PHPDocumentor documentation.
Execute the unit tests
Generate the PHPDocumentor documentation