Apply new limit to new users

I refactored the SubscribersFeature class so that it's easily
unit tested. Computing the subscribers count in the constructor
is better then computing it on every call to check().

[MAILPOET-2394]
This commit is contained in:
Amine Ben hammou
2019-11-26 00:30:48 +01:00
committed by Jack Kitterhing
parent 53e0934a87
commit 042557aafa
4 changed files with 75 additions and 47 deletions

View File

@ -24,6 +24,7 @@ use MailPoet\AdminPages\Pages\WelcomeWizard;
use MailPoet\AdminPages\Pages\WooCommerceListImport;
use MailPoet\DI\ContainerWrapper;
use MailPoet\Features\FeaturesController;
use MailPoet\Settings\SettingsController;
use MailPoet\Util\License\Features\Subscribers as SubscribersFeature;
use MailPoet\Util\License\License;
use MailPoet\WP\Functions as WPFunctions;
@ -66,7 +67,7 @@ class Menu {
}
function init() {
$subscribers_feature = new SubscribersFeature();
$subscribers_feature = new SubscribersFeature($this->container->get(SettingsController::class));
$this->subscribers_over_limit = $subscribers_feature->check();
$this->checkMailPoetAPIKey();
$this->checkPremiumKey();