I am trying to write the integration test. I follow the guide from http://devdocs.magento.com/guides/v2.1/test/integration/integration_test_execution.html to setup the environment. After I updated all requested files (phpunit.xml, install-config-mysql.php), I try to execute the test and get the following error (the phpunit.xml doesn't include my testsuite, just the default testsuite).
Exception: Starting Magento installation: File permissions check... [Progress: 1 / 473] Required extensions check... [Progress: 2 / 473] Enabling Maintenance Mode... [Progress: 3 / 473] Installing deployment configuration... [Progress: 4 / 473] Installing database schema: [Zend_Db_Statement_Exception] SQLSTATE[42S02]: Base table or view not found: 1146 Table 'magento_inte gration_tests.store_website' doesn't exist, query was: SELECT `main_tab le`.* FROM `store_website` AS `main_table` ORDER BY main_table.sort_ord er ASC, main_table.name ASC
Does anyone know why the error happened and how to fix it?
I am using Magento 2.1.9 and PHP 7.0.
Best Answer
If you are sure all your module dependencies are correct as pointed by Fabian, then the problem might be console commands.
I have the same issue and the problem was that some of our console commands had certain dependencies which run sqls inside their constructor.
If you have any console commands make sure their dependencies are loaded either via proxies or factories because every time you run Magento console all command classes are created.
When integration tests initialize they install Magento using console.