Skip to content

Contributing

Guilherme Pressutto edited this page May 23, 2017 · 6 revisions

Guidelines

  1. Benjamin follows PSR-2 and PSR-4.
  2. Benjamin has a minimum PHP version requirement of PHP 5.4 while supports PHP 7.1. Pull requests must not require a PHP version greater than PHP 5.4 and must support PHP 7.1.
  3. Benjamin follows TDD. All pull requests must include unit tests to ensure the change works as expected and to prevent regressions.

Running the tests

In order to contribute, you'll need to checkout the source from GitHub and install Benjamin's dependencies using Composer:

git clone https://github.com/ebanx/benjamin.git
cd benjamin && composer install --dev

Benjamin is unit tested with PHPUnit. Run the tests using the composer script:

composer test

If you want to work on a feature and don't want to run all the tests you can use one of the following composer scripts:

composer test-only TestClass              # run specific unit test class
composer test-only TestClass::testMethod  # run specific unit test method

We also check for duplicate code. You can run this test using the following composer script:

composer check-duplication

If you want to run both unit tests and code duplication check at once you can run the same command travis will run:

composer test-all

We follow PSR-2, but Travis won't check it as StyleCI does it for us. But you can check in your own computer and even get it fixed for you by running the following commands:

composer style-check
composer style-fix
Clone this wiki locally