Skip to content

Latest commit

 

History

History
77 lines (51 loc) · 2.08 KB

CONTRIBUTING.md

File metadata and controls

77 lines (51 loc) · 2.08 KB

Contributing

Getting Started

If you've downloaded or cloned this repo from source, make sure you install dependencies before you do anything else.

composer install

For Windows Users

On a fresh clone of the repo, you may encounter the following error when running composer lint:

[x] End of line character is invalid; expected "\n" but found "\r\n"

This can be fixed by running composer lint-autofix.

In some cases, the composer scripts do not run properly on Windows. Then you will have to copy the corresponding full command from the composer.json file and run it directly instead. For example:

./vendor/bin/phpcbf --standard=PSR12 --error-severity=1 --warning-severity=6 ./src ./test ./sample; if [ $? -eq 1 ]; then exit 0; fi

Linting

Please ensure you lint your code against the PSR-12 coding standard.

composer lint

You can also often auto-correct your code using the following command.

composer lint-autofix

Testing

In order to pass the test suite in your local development environment, you will need to meet some prerequisites. For each of the following, you will need credentials configured in your .env.php file.

  1. A Sandbox Merchant account.
  2. A Sandbox Consumer account, with a stored default payment card.
  3. A local MySQL Server.

Once the above prerequisites have been met, you can run the entire test suite with the following command:

composer test

If you want to run only a specific category of tests, you can also use one of these commands:

composer test-unit
composer test-service
composer test-network
composer test-integration

Or, if you want to only run a specific test case, you can call the PHPUnit binary script with whatever arguments you need.

For example:

./vendor/bin/phpunit --colors=always ./test --filter testNaRegionalApiEnvironmentSelection

Making a Pull Request (PR)

Before making a Pull Request, please ensure you have linted and tested your code, as per the sections above.