diff --git a/mailpoet/tests/integration/Mailer/Methods/MailPoetAPITest.php b/mailpoet/tests/integration/Mailer/Methods/MailPoetAPITest.php index ebd9a311a0..5d9d8fc7e7 100644 --- a/mailpoet/tests/integration/Mailer/Methods/MailPoetAPITest.php +++ b/mailpoet/tests/integration/Mailer/Methods/MailPoetAPITest.php @@ -44,7 +44,7 @@ class MailPoetAPITest extends \MailPoetTest { $this->settings['api_key'], $this->sender, $this->replyTo, - new MailPoetMapper(), + $this->diContainer->get(MailPoetMapper::class), $this->makeEmpty(AuthorizedEmailsController::class) ); $this->subscriber = 'Recipient '; @@ -85,7 +85,7 @@ class MailPoetAPITest extends \MailPoetTest { $this->settings['api_key'], $this->sender, $replyTo, - new MailPoetMapper(), + $this->diContainer->get(MailPoetMapper::class), $this->makeEmpty(AuthorizedEmailsController::class) ); $body = $mailer->getBody($this->newsletter, $this->subscriber); @@ -274,7 +274,7 @@ class MailPoetAPITest extends \MailPoetTest { $this->settings['api_key'], $this->sender, $this->replyTo, - new MailPoetMapper(), + $this->diContainer->get(MailPoetMapper::class), $this->makeEmpty(AuthorizedEmailsController::class, ['checkAuthorizedEmailAddresses' => Expected::once()]) ); $mailer->api = $this->makeEmpty( @@ -295,7 +295,7 @@ class MailPoetAPITest extends \MailPoetTest { $this->mailer, [ 'blacklist' => $blacklist, - 'errorMapper' => new MailPoetMapper(), + 'errorMapper' => $this->diContainer->get(MailPoetMapper::class), 'servicesChecker' => Stub::make( new ServicesChecker(), ['isMailPoetAPIKeyValid' => true], @@ -321,7 +321,7 @@ class MailPoetAPITest extends \MailPoetTest { $this->mailer, [ 'blacklist' => $blacklist, - 'errorMapper' => new MailPoetMapper(), + 'errorMapper' => $this->diContainer->get(MailPoetMapper::class), 'servicesChecker' => Stub::make( new ServicesChecker(), ['isMailPoetAPIKeyValid' => true], diff --git a/mailpoet/tests/unit/Mailer/Methods/ErrorMappers/MailPoetMapperTest.php b/mailpoet/tests/unit/Mailer/Methods/ErrorMappers/MailPoetMapperTest.php index 7d71b61811..f7811dc757 100644 --- a/mailpoet/tests/unit/Mailer/Methods/ErrorMappers/MailPoetMapperTest.php +++ b/mailpoet/tests/unit/Mailer/Methods/ErrorMappers/MailPoetMapperTest.php @@ -3,9 +3,13 @@ namespace MailPoet\Test\Mailer\Methods\ErrorMappers; use Codeception\Stub; +use MailPoet\Config\ServicesChecker; use MailPoet\Mailer\MailerError; use MailPoet\Mailer\Methods\ErrorMappers\MailPoetMapper; +use MailPoet\Services\Bridge; use MailPoet\Services\Bridge\API; +use MailPoet\Settings\SettingsController; +use MailPoet\Util\License\Features\Subscribers; use MailPoet\WP\Functions as WPFunctions; class MailPoetMapperTest extends \MailPoetUnitTest { @@ -17,16 +21,22 @@ class MailPoetMapperTest extends \MailPoetUnitTest { public function _before() { parent::_before(); - $this->mapper = new MailPoetMapper(); - $this->subscribers = ['a@example.com', 'c d ']; - WPFunctions::set(Stub::make(new WPFunctions, [ + $wpFunctions = Stub::make(new WPFunctions, [ '_x' => function ($value) { return $value; }, 'escAttr' => function ($value) { return $value; }, - ])); + ]); + $this->mapper = new MailPoetMapper( + Stub::make(Bridge::class), + Stub::make(ServicesChecker::class), + Stub::make(SettingsController::class), + Stub::make(Subscribers::class), + $wpFunctions + ); + $this->subscribers = ['a@example.com', 'c d ']; } public function testCreateBlacklistError() {