0
0
mirror of https://github.com/PHPMailer/PHPMailer.git synced 2024-09-20 01:52:15 +02:00

HasLineLongerThanMaxTest: switch to preSend()

The line length adjustments are executed within `createBody()` which is called from `preSend()`, so this test doesn't actually need to call `send()`.

I also wonder if this test can be further improved by having more targeted tests for `PHPMailer::hasLineLongerThanMax()` and whether these more extensive tests can be included in a test class which is more targeted at the `createBody()` and/or `preSend()` methods, but that is for later.
This commit is contained in:
jrfnl 2021-07-06 17:17:59 +02:00
parent 55ad6349c9
commit 6e0193958d

View File

@ -14,12 +14,12 @@
namespace PHPMailer\Test\PHPMailer;
use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\Test\SendTestCase;
use PHPMailer\Test\PreSendTestCase;
/**
* Test line length detection and handling.
*/
final class HasLineLongerThanMaxTest extends SendTestCase
final class HasLineLongerThanMaxTest extends PreSendTestCase
{
/**
@ -114,7 +114,7 @@ final class HasLineLongerThanMaxTest extends SendTestCase
$this->Mail->Encoding = '8bit';
$this->Mail->Body = $oklen . $badlen . $oklen . $badlen;
$this->buildBody();
self::assertTrue($this->Mail->send(), $this->Mail->ErrorInfo);
self::assertTrue($this->Mail->preSend(), $this->Mail->ErrorInfo);
self::assertSame('quoted-printable', $this->Mail->Encoding, 'Long line did not override transfer encoding');
}
}