Move onSettingsChange from Bridge service to SettingsChangeHandler

Bridge is a low level service that processes requests and responses to/from Bridge API.
This change is needed so that we can remove dependency on MailPoet\Util\License\Features\Subscribers
service from the Bridge. The dependecy is a higher level service and may easily cause a circular dependency issue.

The SettingsChangeHandler is service for handling side effects
when saving settings. This feels as a better place to put the functionality.
[MAILPOET-5191]
This commit is contained in:
Rostislav Wolny
2023-04-25 14:38:40 +02:00
committed by Veljko V
parent ab19ef92d5
commit cd5a023b35
6 changed files with 82 additions and 67 deletions

View File

@ -101,7 +101,7 @@ class SettingsTest extends \MailPoetTest {
$this->endpoint = new Settings(
$this->settings,
$this->make(Bridge::class, ['onSettingsSave' => Expected::once()]),
$this->diContainer->get(Bridge::class),
$this->make(AuthorizedEmailsController::class, ['onSettingsSave' => Expected::once()]),
$this->diContainer->get(AuthorizedSenderDomainController::class),
$this->make(TransactionalEmails::class),
@ -113,7 +113,7 @@ class SettingsTest extends \MailPoetTest {
$this->diContainer->get(FormMessageController::class),
$this->make(ServicesChecker::class, ['isMailPoetAPIKeyPendingApproval' => false]),
$this->diContainer->get(SegmentsRepository::class),
$this->diContainer->get(SettingsChangeHandler::class),
$this->make(SettingsChangeHandler::class, ['updateBridge' => Expected::once()]),
$this->diContainer->get(SubscribersCountsController::class),
$this->diContainer->get(TrackingConfig::class),
$this->diContainer->get(ConfirmationEmailCustomizer::class)