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.

Looks like a similar issue as in Setup scripts fail integration tests in Magento2

In your case, the setup script of a custom module runs before the one of Magento_Store. This only happens in integration tests where all setup scripts are run at once (otherwise you usually install Magento first, then add extensions).

Solution: Add Magento_store as a module dependency to the module that throws the error.

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.

Your Answer

 
discard

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.