How to contribute?
Contribution are always welcome and much appreciated!
The development of auditor
is hosted on GitHub.
Before starting to contribute, you first need to install dev dependencies:
composer install --dev
You also have to install external dev tools:
composer install --working-dir=tools/php-cs-fixer
composer install --working-dir=tools/phpstan
Also, in an effort to maintain an homogeneous code base, we strongly encourage contributors to run PHP-CS-Fixer and PHPStan before submitting a Pull Request.
Coding standards are enforced using PHP-CS-Fixer
composer csfixer
Static code analysis can be achieved using PHPStan
composer phpstan
By default, test suite is configured to use an SQLite in-memory database and generates
a code coverage report in tests/coverage
folder.
However, you can run the test suite using different configurations:
This configuration uses an in memory SQLite database and generates code coverage report
in tests/coverage
folder (requires PCOV extension).
composer test
You can also run tests using an in memory SQLite database and without generating code coverage report, it's the fastest configuration.
./vendor/bin/phpunit -c phpunit.sqlite.xml
This configuration expects to connect to a MySQL database.
./vendor/bin/phpunit -c phpunit.mysql.xml
Note
Connection parameters (username, password, host, port, etc) are set in phpunit.mysql.xml
file.
Assuming you have docker installed, you can easily start a MySQL server with following command (MySQL 8)
docker run --name mysql_db -e MYSQL_DATABASE=auditor -e MYSQL_ALLOW_EMPTY_PASSWORD=1 -d -p 3306:3306 mysql --default-authentication-plugin=mysql_native_password
This configuration expects to connect to a PostgreSQL database.
./vendor/bin/phpunit -c phpunit.pgsql.xml
Note
Connection parameters (username, password, host, port, etc) are set in phpunit.pgsql.xml
file.
Assuming you have docker installed, you can easily start a PostgreSQL server with following command (PostgreSQL 11)
docker run --name postgres_db -e POSTGRES_DB=auditor -e POSTGRES_HOST_AUTH_METHOD=trust -d -p 5432:5432 postgres
This configuration expects to connect to a MariaDB database.
./vendor/bin/phpunit -c phpunit.mariadb.xml
Note
Connection parameters (username, password, host, port, etc) are set in phpunit.mariadb.xml
file.
Assuming you have docker installed, you can easily start a MariaDB server with following command
docker run --name mariadb_db -e MYSQL_DATABASE=auditor -e MYSQL_ALLOW_EMPTY_PASSWORD=1 -p 3306:3306 mariadb