|
1 | | -Thank you for considering to contribute to this project. |
| 1 | +# Contributing |
2 | 2 |
|
3 | | -Please don't introduce changes without talking about them to the |
4 | | -repository maintainers first - this way we can avoid that you |
5 | | -put your valuable time and effort into a Pull Request that |
6 | | -eventually could not be merged. |
| 3 | +## Before you start |
7 | 4 |
|
8 | | -If you want to provide a bugfix, please include tests to |
9 | | -prove that the bug exists and that it is fixed. |
| 5 | +Please do not introduce changes without talking to the repository maintainers first. That way nobody spends time on a pull request that cannot be merged. |
10 | 6 |
|
11 | | -Support the project's development and keep it sustainable by becoming a |
12 | | -[GitHub Sponsor](https://github.com/sponsors/jeromegamez). |
| 7 | +If you want to provide a bug fix, include tests that prove the bug exists and that it is fixed. |
| 8 | + |
| 9 | +## Local setup |
| 10 | + |
| 11 | +1. Install project dependencies: |
| 12 | + |
| 13 | + ```bash |
| 14 | + composer setup |
| 15 | + ``` |
| 16 | + |
| 17 | +2. Create local test env config from [tests/.env.dist](../tests/.env.dist): |
| 18 | + |
| 19 | + ```bash |
| 20 | + cp tests/.env.dist tests/.env |
| 21 | + ``` |
| 22 | + |
| 23 | +3. Fill in the required values in `tests/.env`: |
| 24 | + |
| 25 | + - `GOOGLE_APPLICATION_CREDENTIALS` |
| 26 | + - `TEST_FIREBASE_APP_ID` |
| 27 | + - `TEST_FIREBASE_RTDB_URI` |
| 28 | + - `TEST_FIREBASE_TENANT_ID` |
| 29 | + - `TEST_REGISTRATION_TOKENS` |
| 30 | + - `TEST_FIRESTORE_CUSTOM_DB_NAME` if you use a custom Firestore database |
| 31 | + |
| 32 | +4. If you run emulator tests, install the Firebase CLI and make sure it can start Auth and Realtime Database emulators. The test suite uses ports `9099` and `9100`. |
| 33 | + |
| 34 | + ```bash |
| 35 | + composer test:emulator |
| 36 | + ``` |
| 37 | + |
| 38 | +## Useful commands |
| 39 | + |
| 40 | +### Lint |
| 41 | + |
| 42 | +```bash |
| 43 | +composer lint |
| 44 | +``` |
| 45 | + |
| 46 | +Runs Rector, PHP-CS-Fixer, and composer normalization checks. |
| 47 | + |
| 48 | +### Typecheck / static analysis |
| 49 | + |
| 50 | +```bash |
| 51 | +composer analyze |
| 52 | +``` |
| 53 | + |
| 54 | +Runs PHPStan. |
| 55 | + |
| 56 | +### Tests |
| 57 | + |
| 58 | +```bash |
| 59 | +composer test:unit |
| 60 | +composer test:integration |
| 61 | +composer test:emulator |
| 62 | +composer test:all |
| 63 | +``` |
| 64 | + |
| 65 | +Before pushing, run: |
| 66 | + |
| 67 | +```bash |
| 68 | +composer pre-push |
| 69 | +``` |
| 70 | + |
| 71 | +This runs lint fixes, full tests, and backward-compat checks. |
| 72 | + |
| 73 | +### Coverage |
| 74 | + |
| 75 | +```bash |
| 76 | +composer test:coverage |
| 77 | +``` |
| 78 | + |
| 79 | +## Notes |
| 80 | + |
| 81 | +- `tests/bootstrap.php` loads `tests/.env` automatically. |
| 82 | +- `tests/bin/reset-project` also reads `tests/.env` and requires `GOOGLE_APPLICATION_CREDENTIALS`. |
| 83 | + Use only with test or integration projects. It deletes Realtime Database data and Auth users. |
| 84 | + Do not run against production projects. |
| 85 | +- Keep changes focused and follow existing code style. |
| 86 | + |
| 87 | +## Thanks |
| 88 | + |
| 89 | +Support the project’s development and keep it sustainable by becoming a [GitHub Sponsor](https://github.com/sponsors/jeromegamez). |
0 commit comments