We develop customer specific projects in Magento 2.3.x, with different customer specific extensions.
Development is based on a copy of the production database (master.sql), so we do not usually use install scripts to setup the full customer data and products, but do this in the admin panel, if possible.
The master.sql contains the product catalog, but not the customer data.
Thus said, we did not do much automatic testing yet - for reasons.
We want to introduce automated testing now, on "all levels" Magento 2 provides. But it would not make sense to reengineer the full project fixture wise. This is why we would like to base test tests for our custom modules on the master.sql database.
For ApiFunctional tests for example, we found out already, that we can set in phpunit_rest.xml
<const name="TESTS_CLEANUP" value="disabled"/>
<const name="TESTS_MAGENTO_INSTALLATION" value="disabled"/>
and in install-config-mysql.php
we can use the MySQL credentials for the just imported master.sql and set 'cleanup-database' => false,
Next we found out, that when using fixtures from the sales module vendor/magento/magento2-base/dev/tests/integration/testsuite/Magento/Sales/_files/default_rollback.php
cleans up all orders, products and stocks. That is why we would patch that file.
And here it begins to feel messy, that is why I asking here
- Is anybody else using this approach?
- Is it a very bad idea or could it work?
- What are you "best practices" and tricks to make this work?