If you've downloaded or cloned this repo from source, make sure you install dependencies before you do anything else.
composer install
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
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
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.
- A Sandbox Merchant account.
- A Sandbox Consumer account, with a stored default payment card.
- 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
Before making a Pull Request, please ensure you have linted and tested your code, as per the sections above.