Edit plugin config in UnitTest Shopware

Viewed 36

I would like to test the function of a plugin that uses a plugin config.

is it possible to edit the config of a plugin in a UnitTest?

1 Answers

It's always a good idea to look for existing tests as an example.

For example full-text-search for "Config" in vendor/shopware/storefront/Test.

This leads to vendor/shopware/storefront/Test/Page/ProductPageTest.php:93 for example:

// enable hideCloseoutProductsWhenOutOfStock filter
$this->getContainer()->get(SystemConfigService::class)
     ->set('core.listing.hideCloseoutProductsWhenOutOfStock', true);
Related