From 52930d5d7503e0b9c18cef34a4da0e0d0f7d4eed Mon Sep 17 00:00:00 2001 From: Richard Shank Date: Wed, 7 May 2014 14:26:22 -0700 Subject: [PATCH] update Message::decode test --- tests/Fetch/Test/MessageTest.php | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/tests/Fetch/Test/MessageTest.php b/tests/Fetch/Test/MessageTest.php index de9ce25..970cd30 100644 --- a/tests/Fetch/Test/MessageTest.php +++ b/tests/Fetch/Test/MessageTest.php @@ -206,16 +206,24 @@ class MessageTest extends \PHPUnit_Framework_TestCase $this->assertEquals($sentFolderNumStart + 1, $server->numMessages(), 'Message moved into Sent Folder.'); } - public function testDecode() { + $quotedPrintableDecoded = "Now's the time for all folk to come to the aid of their country."; + $quotedPrintable = <<<'ENCODE' +Now's the time = +for all folk to come= + to the aid of their country. +ENCODE; + $this->assertEquals($quotedPrintableDecoded, Message::decode($quotedPrintable, 'quoted-printable'), 'Decodes quoted printable'); + $this->assertEquals($quotedPrintableDecoded, Message::decode($quotedPrintable, 4), 'Decodes quoted printable'); + $testString = 'This is a test string'; - - $quotedPrintable = quoted_printable_encode($testString); - $this->assertEquals($testString, Message::decode($quotedPrintable, 'quoted-printable'), 'Decodes quoted printable'); - $base64 = base64_encode($testString); $this->assertEquals($testString, Message::decode($base64, 'base64'), 'Decodes quoted base64'); + $this->assertEquals($testString, Message::decode($base64, 3), 'Decodes quoted base64'); + + $notEncoded = '> w - www.somesite.com.au'; + $this->assertEquals($notEncoded, Message::decode($notEncoded, 0), 'Nothing to decode'); } public function testTypeIdToString()