shopware/development

Automatically also modify test-database when installing plugins

MichaelS86 opened this issue · 3 comments

Description
When installing a plugin, it is only installed in the normal database shopware but neither is the plugin added to the plugin and plugin_translation tables of the database shopware_test nor are the migrations of the plugin applied to it.
Please make the installation process of the plugin also consider the test database. The same for the unistallation.

Example
bin/console plugin:install PLUGIN_NAME should additionally add the plugin PLUGIN_NAME to the database shopware_test and apply the migrations on that database.

this should not be part of the platform as this is only relevant for development.
instead there should be a psh command in the Dev template which handles this

That would be fine just as well. Any command is better than enabling a plugin manually for testing, which is quite cumbersome.

When using the development template, the problem can be circumvented by running ./psh.phar init-test-databases after the plugin was installed & activated in the "main" database.

So I am not sure an additional command is necessary---I guess there COULD be a psh.phar command to manually activate a plugin in the test database, but it will generally be expedient to have the test database to be a copy of the main database, so I am not sure creating such a command would be all that useful.

What SHOULD be improved is the documentation. The page on unit tests for plugins does instruct the user to run the init-test-databases command, but it does not advise the use to make sure that the plugin is activated before doing so (/to re-run the command after activating additional plugins). This probably should be fixed.

So maybe this issue should be transferred to the docs repository?

ASIDE:
I somewhat disagree that this issue is only relevant if using the development template, which is why I created this issue in the platform repo. People do use the production template when developing "custom" modules geared to a specific site, and this is encouraged by some out there (e.g. Jisse Reitsma in his videos on the "Shopware Academy" - regardless of his reasons for doing so and their merits, people will follow his advice, and still will want to run tests on their plugins).