Move current unit tests to integration tests

This commit is contained in:
wxa
2018-10-17 13:27:34 +03:00
parent b21ef30202
commit 87e515b89d
175 changed files with 0 additions and 0 deletions

View File

@@ -0,0 +1,56 @@
<?php
namespace MailPoet\Test\Cron\Workers;
use Codeception\Stub;
use Codeception\Stub\Expected;
use MailPoet\Cron\Workers\SendingQueue\SendingErrorHandler;
use MailPoet\Mailer\MailerError;
use MailPoet\Mailer\SubscriberError;
use MailPoet\Tasks\Sending as SendingTask;
class SendingErrorHandlerTest extends \MailPoetTest {
/** @var SendingErrorHandler */
private $error_handler;
function _before() {
$this->error_handler = new SendingErrorHandler();
}
function testItShouldProcessSoftErrorCorrectly() {
$subscribers = [
'john@doe.com',
'john@rambo.com',
];
$subscriber_ids = [1, 2];
$subscriber_errors = [
new SubscriberError('john@doe.com', 'Subscriber Message'),
new SubscriberError('john@rambo.com', null),
];
$error = new MailerError(
MailerError::OPERATION_SEND,
MailerError::LEVEL_SOFT,
'Error Message',
null, $subscriber_errors
);
$sending_task = Stub::make(
SendingTask::class,
[
'saveSubscriberError' => Expected::exactly(
2,
function($id, $message) {
if($id === 2) {
expect($message)->equals('Error Message');
} else {
expect($message)->equals('Subscriber Message');
}
}
),
],
$this
);
$this->error_handler->processError($error, $sending_task, $subscriber_ids, $subscribers);
}
}