From 3e306974edcc3964a7ecbb535a06cb465e80e9c6 Mon Sep 17 00:00:00 2001 From: Brezo Cordero <8002881+brezocordero@users.noreply.github.com> Date: Thu, 16 Sep 2021 14:06:58 -0500 Subject: [PATCH] Fix SMTPMapper test [MAILPOET-3171] --- .../Mailer/Methods/ErrorMappers/SMTPMapperTest.php | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/tests/unit/Mailer/Methods/ErrorMappers/SMTPMapperTest.php b/tests/unit/Mailer/Methods/ErrorMappers/SMTPMapperTest.php index 3e436266ef..87bd77dd8a 100644 --- a/tests/unit/Mailer/Methods/ErrorMappers/SMTPMapperTest.php +++ b/tests/unit/Mailer/Methods/ErrorMappers/SMTPMapperTest.php @@ -8,6 +8,7 @@ use MailPoet\Mailer\MailerError; use MailPoet\Mailer\Methods\ErrorMappers\SMTPMapper; use MailPoet\WP\Functions as WPFunctions; use MailPoetVendor\Swift_RfcComplianceException; +use MailPoetVendor\Swift_TransportException; class SMTPMapperTest extends \MailPoetUnitTest { @@ -47,17 +48,17 @@ class SMTPMapperTest extends \MailPoetUnitTest { . 'Log data:' . PHP_EOL . '++ Starting Swift_SmtpTransport' . PHP_EOL . '!! Connection could not be established with host localhost [Connection timed out] (code: 463)'; - $error = $this->mapper->getErrorFromException(new Swift_RfcComplianceException($message), 'john@rambo.com'); + $error = $this->mapper->getErrorFromException(new Swift_TransportException($message, 463), 'john@rambo.com'); expect($error->getLevel())->equals(MailerError::LEVEL_SOFT); } public function testItCreatesHardErrorForTransportException500to504() { - $message = 'Bad sequence of commands' . PHP_EOL + $message = 'Connection could not be established with host localhost [Bad sequence of commands]' . PHP_EOL . 'Log data:' . PHP_EOL . '++ Starting Swift_SmtpTransport' . PHP_EOL - . '!! Bad sequence of commands (code: 503)'; - $error = $this->mapper->getErrorFromException(new Swift_RfcComplianceException($message), 'john@rambo.com'); - expect($error->getLevel())->equals(MailerError::LEVEL_SOFT); + . '!! Connection could not be established with host localhost [Bad sequence of commands] (code: 503)'; + $error = $this->mapper->getErrorFromException(new Swift_TransportException($message, 503), 'john@rambo.com'); + expect($error->getLevel())->equals(MailerError::LEVEL_HARD); } public function testItCanProcessLogMessageWhenOneExists() {