Fix dependecies in tests

[MAILPOET-3588]
This commit is contained in:
Jan Lysý
2021-04-30 13:21:35 +02:00
committed by Veljko V
parent 6a9e692f64
commit 9cba4efcee
2 changed files with 11 additions and 2 deletions

View File

@ -16,7 +16,7 @@ class SendingErrorHandlerTest extends \MailPoetTest {
public function _before() {
parent::_before();
$this->errorHandler = new SendingErrorHandler();
$this->errorHandler = $this->diContainer->get(SendingErrorHandler::class);
}
public function testItShouldProcessSoftErrorCorrectly() {

View File

@ -61,6 +61,8 @@ class SendingQueueTest extends \MailPoetTest {
public $segment;
public $subscriber;
private $mailerTaskDummyResponse = ['response' => true];
/** @var SendingThrottlingHandler */
private $sendingThrottlingHandler;
/** @var SendingErrorHandler */
private $sendingErrorHandler;
/** @var SettingsController */
@ -122,7 +124,8 @@ class SendingQueueTest extends \MailPoetTest {
$this->newsletterLink->hash = 'abcde';
$this->newsletterLink->save();
$this->subscribersFinder = $this->diContainer->get(SubscribersFinder::class);
$this->sendingErrorHandler = new SendingErrorHandler();
$this->sendingErrorHandler = $this->diContainer->get(SendingErrorHandler::class);
$this->sendingThrottlingHandler = $this->diContainer->get(SendingThrottlingHandler::class);
$this->statsNotificationsWorker = Stub::makeEmpty(StatsNotificationsScheduler::class);
$this->loggerFactory = LoggerFactory::getInstance();
$this->cronHelper = $this->diContainer->get(CronHelper::class);
@ -168,6 +171,7 @@ class SendingQueueTest extends \MailPoetTest {
], $this);
$sendingQueueWorker->__construct(
$this->sendingErrorHandler,
$this->sendingThrottlingHandler,
$this->statsNotificationsWorker,
$this->loggerFactory,
Stub::makeEmpty(NewslettersRepository::class),
@ -192,6 +196,7 @@ class SendingQueueTest extends \MailPoetTest {
], $this);
$sendingQueueWorker->__construct(
$this->sendingErrorHandler,
$this->sendingThrottlingHandler,
$this->statsNotificationsWorker,
$this->loggerFactory,
Stub::makeEmpty(NewslettersRepository::class),
@ -233,6 +238,7 @@ class SendingQueueTest extends \MailPoetTest {
], $this);
$sendingQueueWorker->__construct(
$this->sendingErrorHandler,
$this->sendingThrottlingHandler,
$this->statsNotificationsWorker,
$this->loggerFactory,
Stub::makeEmpty(NewslettersRepository::class),
@ -273,6 +279,7 @@ class SendingQueueTest extends \MailPoetTest {
], $this);
$sendingQueueWorker->__construct(
$this->sendingErrorHandler,
$this->sendingThrottlingHandler,
$this->statsNotificationsWorker,
$this->loggerFactory,
Stub::makeEmpty(NewslettersRepository::class),
@ -788,6 +795,7 @@ class SendingQueueTest extends \MailPoetTest {
);
$sendingQueueWorker->__construct(
$this->sendingErrorHandler,
$this->sendingThrottlingHandler,
$this->statsNotificationsWorker,
$this->loggerFactory,
Stub::makeEmpty(NewslettersRepository::class),
@ -1002,6 +1010,7 @@ class SendingQueueTest extends \MailPoetTest {
private function getSendingQueueWorker($newsletterRepositoryMock = null, $mailerMock = null) {
return new SendingQueueWorker(
$this->sendingErrorHandler,
$this->sendingThrottlingHandler,
$this->statsNotificationsWorker,
$this->loggerFactory,
$newsletterRepositoryMock ?: $this->newslettersRepository,