Foreign key constraints often mean that inserting a fixture record into a test database for one model is not possible until records exist in other tables, which themselves may each have more dependencies, and so on. Is there any way to specify these dependencies in Cake’s TestFixtures?
Suppose I have model A that has foreign keys to models B, C and D. Model C has a foreign key to E, as does D to F and G. It would be great if I could specify those requirements once in the fixtures themselves. That way in any test in which I explicitly wanted to add a fixture for A, I could just add that fixture, and all of its dependencies would come along for the ride. Otherwise for every test case that involves A (either directly, or because I’m testing something else that has A as a dependency), I have to add the full properly ordered sequence [F, G, D, E, C, B, A] to whatever other fixtures are also needed for that test.
Is there any way in Cake to do what I’m talking about? Does this idea make as much sense as I think it does, or have I overlooked something about how I should be integration testing my controllers?