Currently, Eloquent relationships are tested using dedicated Model test classes, but the relationship test methods should be moved into the Repository test classes.
Once that's been done, the Model test classes can simply be deleted.
To elaborate a bit as to the impetus for this change:
We didn't like the idea of relying on the Model facades any more than is absolutely necessary, and the only clean and minimally-redundant way to do that was to move the Eloquent relationship tests into the repository test classes.
This change will make our tests less fragile, because they won't break if Laravel changes something in Eloquent (although, that's not 100% true yet, per my comments in PR #77 ).
Furthermore, the old tests relied on seeding too heavily, which gave them an unwanted element of randomness, and caused their execution time to be much longer than necessary.
By contrast, these revisions will take a bare-minimum seeding approach, oftentimes seeding only the Countries table, in order to satisfy foreign key constraint requirements. Any other database work is done strictly on an as-needed basis, with records being created individually and on-demand, on a per-test-method basis.
Currently, Eloquent relationships are tested using dedicated Model test classes, but the relationship test methods should be moved into the Repository test classes.
Once that's been done, the Model test classes can simply be deleted.
To elaborate a bit as to the impetus for this change:
We didn't like the idea of relying on the Model facades any more than is absolutely necessary, and the only clean and minimally-redundant way to do that was to move the Eloquent relationship tests into the repository test classes.
This change will make our tests less fragile, because they won't break if Laravel changes something in Eloquent (although, that's not 100% true yet, per my comments in PR #77 ).
Furthermore, the old tests relied on seeding too heavily, which gave them an unwanted element of randomness, and caused their execution time to be much longer than necessary.
By contrast, these revisions will take a bare-minimum seeding approach, oftentimes seeding only the Countries table, in order to satisfy foreign key constraint requirements. Any other database work is done strictly on an as-needed basis, with records being created individually and on-demand, on a per-test-method basis.