Files
piratepoet/mailpoet/tests/unit/Mailer/Methods/ErrorMappers/SMTPMapperTest.php
Rodrigo Primo afe378ba22 Replace expect()->equals() with verify()->equals()
codeception/verify 2.1 removed support for expect()->equals() so we need
to replace it with verify()->equals().

[MAILPOET-5664]
2023-10-24 08:58:22 +03:00

40 lines
1.0 KiB
PHP

<?php declare(strict_types = 1);
namespace MailPoet\Test\Mailer\Methods\ErrorMappers;
use Codeception\Stub;
use MailPoet\Mailer\MailerError;
use MailPoet\Mailer\Methods\ErrorMappers\SMTPMapper;
use MailPoet\Mailer\WordPress\PHPMailerLoader;
use MailPoet\WP\Functions as WPFunctions;
use PHPMailer\PHPMailer\Exception;
PHPMailerLoader::load();
class SMTPMapperTest extends \MailPoetUnitTest {
/** @var SMTPMapper */
private $mapper;
public function _before() {
parent::_before();
$this->mapper = new SMTPMapper();
WPFunctions::set(Stub::make(new WPFunctions, [
'__' => function ($value) {
return $value;
},
]));
}
public function testItCreatesSoftErrorForInvalidEmail() {
$message = 'Invalid address (to): john@rambo.com';
$error = $this->mapper->getErrorFromException(new Exception($message), 'john@rambo.com');
verify($error->getLevel())->equals(MailerError::LEVEL_SOFT);
}
public function _after() {
parent::_after();
WPFunctions::set(new WPFunctions);
}
}