diff --git a/mailpoet/lib/API/JSON/v1/Setup.php b/mailpoet/lib/API/JSON/v1/Setup.php index b5a46e2d26..d8e300e575 100644 --- a/mailpoet/lib/API/JSON/v1/Setup.php +++ b/mailpoet/lib/API/JSON/v1/Setup.php @@ -5,6 +5,7 @@ namespace MailPoet\API\JSON\v1; use MailPoet\API\JSON\Endpoint as APIEndpoint; use MailPoet\Config\AccessControl; use MailPoet\Config\Activator; +use MailPoet\Settings\SettingsController; use MailPoet\WP\Functions as WPFunctions; class Setup extends APIEndpoint { @@ -18,17 +19,23 @@ class Setup extends APIEndpoint { /** @var Activator */ private $activator; + /** @var SettingsController */ + private $settings; + public function __construct( WPFunctions $wp, - Activator $activator + Activator $activator, + SettingsController $settings ) { $this->wp = $wp; $this->activator = $activator; + $this->settings = $settings; } public function reset() { try { $this->activator->deactivate(); + $this->settings->resetCache(); $this->activator->activate(); $this->wp->doAction('mailpoet_setup_reset'); return $this->successResponse(); diff --git a/mailpoet/tests/integration/API/JSON/v1/SetupTest.php b/mailpoet/tests/integration/API/JSON/v1/SetupTest.php index 7d71cef3e6..26a7c5fa53 100644 --- a/mailpoet/tests/integration/API/JSON/v1/SetupTest.php +++ b/mailpoet/tests/integration/API/JSON/v1/SetupTest.php @@ -34,7 +34,7 @@ class SetupTest extends \MailPoetTest { $captchaRenderer = $this->diContainer->get(CaptchaRenderer::class); $migrator = $this->diContainer->get(Migrator::class); $cronActionScheduler = $this->diContainer->get(ActionScheduler::class); - $router = new Setup($wpStub, new Activator($this->connection, $settings, $populator, $wpStub, $migrator, $cronActionScheduler)); + $router = new Setup($wpStub, new Activator($this->connection, $settings, $populator, $wpStub, $migrator, $cronActionScheduler), $settings); $response = $router->reset(); verify($response->status)->equals(APIResponse::STATUS_OK);