I am unit- and integration-testing an import/export extension using EcomDev_PHPUnit. For some of the tests I have to make sure that no products are in the database. The problem is that some 3rd party modules are creating products but don't clean up afterwards. What is the best way to work around?
In my opinion the cleanest approach would be to define a fixture telling EcomDev_PHPUnit that I don't want to have any products in the database. Something like that:
eav:
catalog_product:
I'm afraid this isn't implemented in EcomDev_PHPUnit. (Is it?)
Another guess of mine would be I have to add some code to my setUp
-method which deletes all products available via the product collection.
The most error-prone way would be to define all product-related tables in the fixture and to have EcomDev_PHPUnit empty them.
Mighty gods of automated testing, please send me a hint!
PS: I know that normally you would mock results and don't test the actual writing to the database. As the tests should verify that products are written to the database recognized by Magento as intended I guess I have to do it this way. I'm open to suggestions anyways.