Tests/reorganize: move encodeQ tests to own file
This commit is contained in:
parent
904dc698ea
commit
167c81a2cf
|
|
@ -0,0 +1,59 @@
|
|||
<?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 encoding a string using Q encoding functionality.
|
||||
*/
|
||||
final class EncodeQTest extends TestCase
|
||||
{
|
||||
|
||||
/**
|
||||
* Encoding and charset tests.
|
||||
*/
|
||||
public function testEncodings()
|
||||
{
|
||||
$this->Mail->CharSet = PHPMailer::CHARSET_ISO88591;
|
||||
self::assertSame(
|
||||
'=A1Hola!_Se=F1or!',
|
||||
$this->Mail->encodeQ("\xa1Hola! Se\xf1or!", 'text'),
|
||||
'Q Encoding (text) failed'
|
||||
);
|
||||
self::assertSame(
|
||||
'=A1Hola!_Se=F1or!',
|
||||
$this->Mail->encodeQ("\xa1Hola! Se\xf1or!", 'comment'),
|
||||
'Q Encoding (comment) failed'
|
||||
);
|
||||
self::assertSame(
|
||||
'=A1Hola!_Se=F1or!',
|
||||
$this->Mail->encodeQ("\xa1Hola! Se\xf1or!", 'phrase'),
|
||||
'Q Encoding (phrase) failed'
|
||||
);
|
||||
$this->Mail->CharSet = 'UTF-8';
|
||||
self::assertSame(
|
||||
'=C2=A1Hola!_Se=C3=B1or!',
|
||||
$this->Mail->encodeQ("\xc2\xa1Hola! Se\xc3\xb1or!", 'text'),
|
||||
'Q Encoding (text) failed'
|
||||
);
|
||||
// Strings containing '=' are a special case.
|
||||
self::assertSame(
|
||||
'Nov=C3=A1=3D',
|
||||
$this->Mail->encodeQ("Nov\xc3\xa1=", 'text'),
|
||||
'Q Encoding (text) failed 2'
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
@ -861,41 +861,6 @@ EOT;
|
|||
self::assertTrue($this->Mail->send(), 'send failed');
|
||||
}
|
||||
|
||||
/**
|
||||
* Encoding and charset tests.
|
||||
*/
|
||||
public function testEncodings()
|
||||
{
|
||||
$this->Mail->CharSet = PHPMailer::CHARSET_ISO88591;
|
||||
self::assertSame(
|
||||
'=A1Hola!_Se=F1or!',
|
||||
$this->Mail->encodeQ("\xa1Hola! Se\xf1or!", 'text'),
|
||||
'Q Encoding (text) failed'
|
||||
);
|
||||
self::assertSame(
|
||||
'=A1Hola!_Se=F1or!',
|
||||
$this->Mail->encodeQ("\xa1Hola! Se\xf1or!", 'comment'),
|
||||
'Q Encoding (comment) failed'
|
||||
);
|
||||
self::assertSame(
|
||||
'=A1Hola!_Se=F1or!',
|
||||
$this->Mail->encodeQ("\xa1Hola! Se\xf1or!", 'phrase'),
|
||||
'Q Encoding (phrase) failed'
|
||||
);
|
||||
$this->Mail->CharSet = 'UTF-8';
|
||||
self::assertSame(
|
||||
'=C2=A1Hola!_Se=C3=B1or!',
|
||||
$this->Mail->encodeQ("\xc2\xa1Hola! Se\xc3\xb1or!", 'text'),
|
||||
'Q Encoding (text) failed'
|
||||
);
|
||||
//Strings containing '=' are a special case
|
||||
self::assertSame(
|
||||
'Nov=C3=A1=3D',
|
||||
$this->Mail->encodeQ("Nov\xc3\xa1=", 'text'),
|
||||
'Q Encoding (text) failed 2'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Expect exceptions on bad encoding
|
||||
*/
|
||||
|
|
|
|||
Loading…
Reference in New Issue