Testing
Testing Framework¶
Unit Tests¶
All unit tests are located in tests/unit
and are namespaced to match the class they are testing. E.g:
App\Services\General\ContactService
is tested by Tests\Unit\App\Services\General\ContactServiceTest
For tests to work, ensure that Test
is added as a suffix to the class and file name
Mocking and Mockery¶
Integration Tests¶
Database State Management¶
Repository Tests¶
Mail and PDF¶
Mailtrap¶
Any emails sent from the development container should go to mailtrap.io
(send emails
using Edmonds Commerce internal if you can just to be safe).
Redacted
PDF Routes¶
Fixtures¶
When repeatedly polluting the database with test data from manual tests it is advisable to clean the database and rerun the test fixtures when developing. Laravel Doctrine comes with a useful entity definition library for very quickly generating entities on the fly, the fixtures use this system to generate dummy data for testing purposes.
All factory definitions are located in database/factories/definitions.php
and the main fixture class is database/fixtures/TestFixtureLoader.php
The current fixtures do not create projects and companies in the expected way (keeping true to Equip and Working Agreements etc).
To add the fixtures to the database:
1 |
|
Database Reset¶
To clean the database (before re-adding fixtures):
1 |
|
Acceptance Testing (Behat)¶
Before starting to run the acceptance tests, be sure that the following tasks have been completed
Redacted
-
Ensure the database
projects_acceptance
exists (as per.env.behat
, this should already be on the cluster) -
Run the
lxc-selenium ec-projects2
command before executing tasks, this should be left running