set('signup_confirmation.enabled', false); } public function testItCanReinstall() { $wp = Stub::make(new WPFunctions, [ 'doAction' => asCallable([WPHooksHelper::class, 'doAction']), ]); $featuresController = Stub::makeEmpty(FeaturesController::class); $settings = SettingsController::getInstance(); $referralDetector = new ReferralDetector($wp, $settings); $populator = new Populator($settings, $wp, new Captcha(), $referralDetector, $featuresController); $router = new Setup($wp, new Activator($settings, $populator)); $response = $router->reset(); expect($response->status)->equals(APIResponse::STATUS_OK); $settings = SettingsController::getInstance(); $signupConfirmation = $settings->fetch('signup_confirmation.enabled'); expect($signupConfirmation)->true(); $captcha = $settings->fetch('captcha'); $subscriptionCaptcha = new Captcha; $captchaType = $subscriptionCaptcha->isSupported() ? Captcha::TYPE_BUILTIN : Captcha::TYPE_DISABLED; expect($captcha['type'])->equals($captchaType); expect($captcha['recaptcha_site_token'])->equals(''); expect($captcha['recaptcha_secret_token'])->equals(''); $woocommerceOptinOnCheckout = $settings->fetch('woocommerce.optin_on_checkout'); expect($woocommerceOptinOnCheckout['enabled'])->true(); $hookName = 'mailpoet_setup_reset'; expect(WPHooksHelper::isActionDone($hookName))->true(); } public function _after() { $this->diContainer->get(SettingsRepository::class)->truncate(); } }