From 83a8a899be96ffdcaf4b1fe7951a34fd7bedb3dc Mon Sep 17 00:00:00 2001 From: Robert Hafner Date: Sun, 8 Dec 2013 18:31:27 -0800 Subject: [PATCH] Added Message test structure, as well as a few initial tests. --- tests/Fetch/Test/MessageTest.php | 116 +++++++++++++++++++++++++++++++ 1 file changed, 116 insertions(+) diff --git a/tests/Fetch/Test/MessageTest.php b/tests/Fetch/Test/MessageTest.php index 258c1a9..81a86c8 100644 --- a/tests/Fetch/Test/MessageTest.php +++ b/tests/Fetch/Test/MessageTest.php @@ -10,6 +10,7 @@ */ namespace Fetch\Test; +use Fetch\Message; /** @@ -18,10 +19,125 @@ namespace Fetch\Test; */ class MessageTest extends \PHPUnit_Framework_TestCase { + public static function getMessage($id) + { + $server = ServerTest::getServer(); + return new \Fetch\Message($id, $server); + } + + public function testConstructMessage() + { + $message = static::getMessage(3); + $this->assertInstanceOf('\Fetch\Message', $message); + } + + public function testGetOverview() + { + + } + + public function testGetHeaders() + { + + } + + public function testGetStructure() + { + + } public function testGetMessageBody() { } + public function testGetAddresses() + { + + } + + public function testGetDate() + { + + } + + public function testGetSubject() + { + + } + + public function testDelete() + { + + } + + public function testGetImapBox() + { + + } + + public function testGetUid() + { + $message = static::getMessage('3'); + $this->assertEquals(3, $message->getUid(), 'Message returns UID'); + } + + public function testGetAttachments() + { + $messageWithoutAttachments = static::getMessage('3'); + $this->assertFalse($messageWithoutAttachments->getAttachments(), 'getAttachments returns false when no attachments present.'); + + + $messageWithAttachments = static::getMessage('6'); + $attachments = $messageWithAttachments->getAttachments(); + $this->assertCount(2, $attachments); + foreach($attachments as $attachment) + $this->assertInstanceOf('\Fetch\Attachment', $attachment, 'getAttachments returns Fetch\Attachment objects.'); + } + + public function testCheckFlag() + { + + } + + public function testSetFlag() + { + + } + + public function testMoveToMailbox() + { + + } + + + public function testDecode() + { + + } + + public function testTypeIdToString() + { + $types = array(); + $types[0] = 'text'; + $types[1] = 'multipart'; + $types[2] = 'message'; + $types[3] = 'application'; + $types[4] = 'audio'; + $types[5] = 'image'; + $types[6] = 'video'; + $types[7] = 'other'; + $types[8] = 'other'; + $types[32] = 'other'; + + foreach($types as $id => $type) + $this->assertEquals($type, Message::typeIdToString($id)); + } + + public function testGetParametersFromStructure() + { + + } + + }