/**
  * Ensures everathing works as expected
  */
 public function testOk()
 {
     $entity = new \Conjoon\Data\Entity\Mail\ImapMessageEntity();
     $entity->setDate($this->date);
     $entity->setSubject('subject');
     $entity->setTo('*****@*****.**');
     $entity->setCc('*****@*****.**');
     $entity->setBcc('*****@*****.**');
     $entity->setFrom('*****@*****.**');
     $entity->setReplyTo('*****@*****.**');
     $entity->setInReplyTo('*****@*****.**');
     $entity->setReferences('references');
     $entity->setContentTextPlain('contentTextPlain');
     $entity->setContentTextHtml('contentTextHtml');
     $entity->setMessageId('<messageId>');
     $successResult = new GetMessageResult($entity, new \Conjoon\Mail\Client\Message\DefaultMessageLocation(new \Conjoon\Mail\Client\Folder\Folder(new \Conjoon\Mail\Client\Folder\DefaultFolderPath('["1", "2"]')), "1"));
     $this->assertEquals(array('message' => array('id' => null, 'uId' => "1", 'path' => array('1', '2'), 'date' => $this->date, 'subject' => 'subject', 'to' => '*****@*****.**', 'cc' => '*****@*****.**', 'bcc' => '*****@*****.**', 'from' => '*****@*****.**', 'replyTo' => '*****@*****.**', 'inReplyTo' => '*****@*****.**', 'references' => 'references', 'messageId' => '<messageId>', 'contentTextHtml' => 'contentTextHtml', 'contentTextPlain' => 'contentTextPlain', 'attachments' => array())), $successResult->toArray());
 }
 /**
  * inheritdoc
  */
 public function createFrom(\Conjoon\Mail\Message\RawMessage $message)
 {
     $header = $this->parseHeader($message->getHeader());
     $body = $this->parseBody($message->getHeader() . "\n\n" . $message->getBody());
     $message = new \Conjoon\Data\Entity\Mail\ImapMessageEntity();
     $message->setMessageId($header['messageId']);
     $message->setDate($header['date']);
     $message->setSubject($header['subject']);
     $message->setTo($header['to']);
     $message->setCc($header['cc']);
     $message->setBcc($header['bcc']);
     $message->setFrom($header['from']);
     $message->setReplyTo($header['replyTo']);
     $message->setInReplyTo($header['inReplyTo']);
     $message->setReferences($header['references']);
     $this->createAttachments($message, $body);
     $message->setContentTextPlain($body['contentTextPlain']);
     $message->setContentTextHtml($body['contentTextHtml']);
     return $message;
 }