I am working on my first extension that uses TDD principles and I am having trouble figuring out how best to write this particular test. In the module's database table, I have a column called parent_id
which references the table's entity_id
column. My goal is to have this type of parent-child relationship: grandparent > parent > child > grand-child > etc
. To test this, I need to create some sort of dataset that includes the parent and child records. I am not sure if I need to use a fixture, expectation, or something else for this. I also need to know how to assert that the relationship was defined correctly. Can anybody give me some recommendations?
Edit:
I think I have a plan of attack for this and I will post the answer later if my idea works. I think if I create a fixture with the parent record's data, a provider with the child record, and an expectation with the relationship I may be able to use assertSame()
to test it.