Skip to content
This repository has been archived by the owner on Oct 8, 2024. It is now read-only.

Automatically also modify test-database when installing plugins #148

Open
MichaelS86 opened this issue Mar 4, 2021 · 3 comments
Open

Automatically also modify test-database when installing plugins #148

MichaelS86 opened this issue Mar 4, 2021 · 3 comments

Comments

@MichaelS86
Copy link

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.

@mitelg
Copy link
Member

mitelg commented Mar 4, 2021

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

@MichaelS86
Copy link
Author

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

@shyim shyim transferred this issue from shopware/shopware Mar 5, 2021
@svlauer
Copy link

svlauer commented Mar 2, 2022

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).

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants