Tests/reorganize: move encodeString tests to own file

Note: this doesn't move the complete test from the original test file, just select parts of the test method.
This commit is contained in:
jrfnl 2021-07-05 02:27:29 +02:00
parent 687521c5ff
commit 7c8d3f21b2
2 changed files with 43 additions and 13 deletions

View File

@ -0,0 +1,43 @@
<?php
/**
* PHPMailer - PHP email transport unit tests.
* PHP version 5.5.
*
* @author Marcus Bointon <phpmailer@synchromedia.co.uk>
* @author Andy Prevost
* @copyright 2012 - 2020 Marcus Bointon
* @copyright 2004 - 2009 Andy Prevost
* @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License
*/
namespace PHPMailer\Test\PHPMailer;
use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\Test\TestCase;
/**
* Test string encoding functionality.
*/
final class EncodeStringTest extends TestCase
{
/**
* Encoding and charset tests.
*/
public function testEncodings()
{
self::assertSame(
'hello',
$this->Mail->encodeString('hello', 'binary'),
'Binary encoding changed input'
);
$this->Mail->ErrorInfo = '';
$this->Mail->encodeString('hello', 'asdfghjkl');
self::assertNotEmpty($this->Mail->ErrorInfo, 'Invalid encoding not detected');
self::assertMatchesRegularExpression(
'/' . base64_encode('hello') . '/',
$this->Mail->encodeString('hello')
);
}
}

View File

@ -894,19 +894,6 @@ EOT;
$this->Mail->encodeQ("Nov\xc3\xa1=", 'text'),
'Q Encoding (text) failed 2'
);
self::assertSame(
'hello',
$this->Mail->encodeString('hello', 'binary'),
'Binary encoding changed input'
);
$this->Mail->ErrorInfo = '';
$this->Mail->encodeString('hello', 'asdfghjkl');
self::assertNotEmpty($this->Mail->ErrorInfo, 'Invalid encoding not detected');
self::assertMatchesRegularExpression(
'/' . base64_encode('hello') . '/',
$this->Mail->encodeString('hello')
);
}
/**