> ## Documentation Index
> Fetch the complete documentation index at: https://docs.erp.arukz.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Run the ARUKZ ERP test suite

> How to run the ARUKZ ERP Pest suites safely: a test database only, one process per database, run serially with no memory limit, and which suites matter most.

ARUKZ ERP is tested with Pest 4 feature tests that build a complete ERP in a test database before the first test. Run them serially, one test process per database, with `php -d memory_limit=-1 vendor/bin/pest` (what `composer test` does), and only against a database whose name contains `test`: the suite runs `migrate:fresh` and would wipe anything else, so it refuses to start.

## Run a suite

```bash theme={"theme":{"light":"github-light","dark":"github-dark"}}
php -d memory_limit=-1 vendor/bin/pest --compact tests/Feature/Saas
```

Run whole folders rather than single files: each test process first rebuilds the whole ERP (`migrate:fresh`, `erp:install` and every plugin), which takes about 10 to 12 minutes before the first test runs. A full run of every suite takes about two hours.

> [!WARNING]
>
> * **One process per database.** Two test runs against the same database rebuild it under each other and fail in confusing ways. Give each parallel runner its own database.
> * **Do not edit PHP files during a run.** The process loads code as it goes, so an edit mid-run mixes old and new code.
> * **Do not use `php artisan test` for a full run.** It starts Pest under PHP's default 512 MB limit; a full run outgrows it near the end and the process dies without printing a summary, hiding any failures.

## The test database

`phpunit.xml` sets `DB_DATABASE=aureus_testing`. `tests/TestCase.php` refuses to run against a database whose name does not contain `test`, unless `DB_ALLOW_DESTRUCTIVE_TESTS=true` says it is disposable (a throwaway CI container, for example).

If the application has its config cached (as production does), a test process would read the cached settings instead of `phpunit.xml`. Point it at empty cache files so it reads `phpunit.xml` without clearing the live caches:

```bash theme={"theme":{"light":"github-light","dark":"github-dark"}}
APP_CONFIG_CACHE=/tmp/t-config.php APP_ROUTES_CACHE=/tmp/t-routes.php \
APP_EVENTS_CACHE=/tmp/t-events.php APP_SERVICES_CACHE=/tmp/t-services.php \
APP_PACKAGES_CACHE=/tmp/t-packages.php \
php -d memory_limit=-1 vendor/bin/pest --compact tests/Feature/Saas
```

Heavy test runs load the database server. Run them in CI or on a machine that does not also serve customers.

## Which suites matter

| Suite | Covers |
| - | - |
| `tests/Feature/Saas` | Sign-up, tenants, billing, read-only mode, company addresses and isolation between companies |
| `tests/Feature/Arukz` | Every ARUKZ model is company-scoped (`CompanyScopingTest`) and every ARUKZ file imports only classes that exist (`ModuleIntegrityTest`) |
| `tests/Feature/GstReturns`, `Gstr2b`, `EInvoice`, `EwayBill`, `GstCompliance`, `Tds`, `Msme` | Indian tax figures, registers and files |
| `tests/Feature/JobWork`, `Manufacturing`, `Quality`, `StockLedger`, `Books`, `OpeningData` | Job work and ITC-04, production, quality, stock valuation, Day Book and Ledger, Tally import |
| `tests/Feature/Ai`, `Modules`, `Audit`, `Dashboards` | Ask AI and MCP, module switches, the audit trail, home page widgets |
| `plugins/*/*/tests/Feature` | Each Aureus ERP plugin's own tests |

## What a new feature should add

* An isolation test: a record made in company A is not returned to a user of company B.
* A permission test: a role without the permission cannot open the screen or call the action.
* For anything with a number series, a test that two companies can both start at `0001`.

[Build a custom plugin](https://docs.erp.arukz.com/developers/custom-plugin.md) shows these for a new module.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.