From af68fb202a7d0be2da49898998d66cd077018db8 Mon Sep 17 00:00:00 2001 From: jrfnl Date: Tue, 29 Jun 2021 13:18:00 +0200 Subject: [PATCH] TestCase::setAddress(): add support for `ReplyTo` This allows for using the `setAddress()` method in a more consistent manner (where appropriate). Includes introducing the use of the `setAddress()` function in a few select places. Note: I do wonder whether this method should ever be used outside of `set_up()` and `tear_down()`, but that is for further discussion and outside the scope of this commit. --- test/PHPMailer/MailTransportTest.php | 2 +- test/TestCase.php | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/test/PHPMailer/MailTransportTest.php b/test/PHPMailer/MailTransportTest.php index 7b70753b..fbb6721b 100644 --- a/test/PHPMailer/MailTransportTest.php +++ b/test/PHPMailer/MailTransportTest.php @@ -81,7 +81,7 @@ final class MailTransportTest extends TestCase $this->setAddress('testmailsend@example.com', 'totest'); $this->setAddress('cctestmailsend@example.com', 'cctest', $sType = 'cc'); $this->setAddress('bcctestmailsend@example.com', 'bcctest', $sType = 'bcc'); - $this->Mail->addReplyTo('replytotestmailsend@example.com', 'replytotest'); + $this->setAddress('replytotestmailsend@example.com', 'replytotest', $sType = 'ReplyTo'); self::assertContains('testmailsend@example.com', $this->Mail->getToAddresses()[0], 'To address not found'); self::assertContains('cctestmailsend@example.com', $this->Mail->getCcAddresses()[0], 'CC address not found'); diff --git a/test/TestCase.php b/test/TestCase.php index e1848f1c..8cdd2b28 100644 --- a/test/TestCase.php +++ b/test/TestCase.php @@ -121,7 +121,7 @@ abstract class TestCase extends PolyfillTestCase if (array_key_exists('mail_userpass', $_REQUEST)) { $this->Mail->Password = $_REQUEST['mail_userpass']; } - $this->Mail->addReplyTo('no_reply@phpmailer.example.com', 'Reply Guy'); + $this->setAddress('no_reply@phpmailer.example.com', 'Reply Guy', 'ReplyTo'); $this->Mail->Sender = 'unit_test@phpmailer.example.com'; if ($this->Mail->Host != '') { $this->Mail->isSMTP(); @@ -297,6 +297,8 @@ abstract class TestCase extends PolyfillTestCase return $this->Mail->addCC($sAddress, $sName); case 'bcc': return $this->Mail->addBCC($sAddress, $sName); + case 'ReplyTo': + return $this->Mail->addReplyTo($sAddress, $sName); } return false;