Unit Testing¶
Because zf-doctrine-audit uses stored procedures sqlite isn’t enough for unit testing. To setup unit testing follow these steps:
- Clone the repository outside of a project and cd into the repository directory.
- Run
docker-compose up -d
to start a container to work in. You may need to install Docker if you’re not already using it. - Run
docker/connect
to connect to a shell inside the container. - Run
composer install
to install required libraries. - Run
vendor/bin/phpunit
to execute the unit tests.
After the unit tests have ran the database will still exist.
Connect to mysql with mysql -u root -h mysql test
to explore the database.
The audit database has the audit trails for the test data.
Manipulating data in the test database is immediatly audited in the audit database.