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

EncodeStringTest: fix incorrect assertion

Using a regex assertion with arbitrary input data which is not regex escaped, makes this test suspect.
From the looks of it, the test _should_ be testing that the output is the _same_, so let's use that assertion.
This commit is contained in:
jrfnl 2021-07-05 02:33:56 +02:00
parent 7c8d3f21b2
commit 2380a16f5e

View File

@ -35,8 +35,8 @@ final class EncodeStringTest extends TestCase
$this->Mail->ErrorInfo = '';
$this->Mail->encodeString('hello', 'asdfghjkl');
self::assertNotEmpty($this->Mail->ErrorInfo, 'Invalid encoding not detected');
self::assertMatchesRegularExpression(
'/' . base64_encode('hello') . '/',
self::assertSame(
base64_encode('hello') . PHPMailer::getLE(),
$this->Mail->encodeString('hello')
);
}