<commit_before><?php
/**
 * conjoon
 * (c) 2002-2012 siteartwork.de/conjoon.org
 * <EMAIL>
 *
 * $Author$
 * $Id$
 * $Date$
 * $Revision$
 * $LastChangedDate$
 * $LastChangedBy$
 * $URL$
 */


namespace Conjoon\Mail\Server\Protocol\DefaultResult;

/**
 * @see SetFlagsResult
 */
require_once 'Conjoon/Mail/Server/Protocol/DefaultResult/GetMessageResult.php';


/**
 * @category   Conjoon
 * @package    Conjoon_Mail
 * @subpackage UnitTests
 * @group      Conjoon_Mail
 *
 * @author <NAME> <<EMAIL>>
 */
class GetMessageResultTest extends \PHPUnit_Framework_TestCase {

    protected $input;

    /**
     * Ensures everathing works as expected
     */
    public function testOk()
    {
        $entity = new \Conjoon\Data\Entity\Mail\ImapMessageEntity();

        $entity->setDate('1970-01-01 00:00:00');
        $entity->setSubject('subject');
        $entity->setTo('<EMAIL>');
        $entity->setCc('<EMAIL>');
        $entity->setBcc('<EMAIL>');
        $entity->setFrom('<EMAIL>');
        $entity->setReplyTo('<EMAIL>');
        $entity->setInReplyTo('<EMAIL>');
        $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(
                    'uId'        => "1",
                    'path'       => array('1', '2'),
                    'date'       => '1970-01-01 00:00:00',
                    'subject'    => 'subject',
                    'to'         => '<EMAIL>',
                    'cc'         => '<EMAIL>',
                    'bcc'        => '<EMAIL>',
                    'from'       => '<EMAIL>',
                    'replyTo'    => '<EMAIL>',
                    'inReplyTo'  => '<EMAIL>',
                    'references' => 'references',
                    'messageId'  => '<messageId>',
                    'contentTextHtml'  => 'contentTextHtml',<commit_msg>[Email module - backend] - fixed: fixed an issue where unit tests would not consider recent bug fixes related to argument type of message entity's "setDate()" closes CN-785)<commit_after><?php
/**
 * conjoon
 * (c) 2002-2012 siteartwork.de/conjoon.org
 * <EMAIL>
 *
 * $Author$
 * $Id$
 * $Date$
 * $Revision$
 * $LastChangedDate$
 * $LastChangedBy$
 * $URL$
 */


namespace Conjoon\Mail\Server\Protocol\DefaultResult;

/**
 * @see SetFlagsResult
 */
require_once 'Conjoon/Mail/Server/Protocol/DefaultResult/GetMessageResult.php';


/**
 * @category   Conjoon
 * @package    Conjoon_Mail
 * @subpackage UnitTests
 * @group      Conjoon_Mail
 *
 * @author <NAME> <<EMAIL>>
 */
class GetMessageResultTest extends \PHPUnit_Framework_TestCase {

    protected $input;

    protected $date;

    protected function setUp() {
        $this->date = new \DateTime('1970-01-01 00:00:00', new \DateTimeZone('UTC'));
    }

    /**
     * Ensures everathing works as expected
     */
    public function testOk()
    {
        $entity = new \Conjoon\Data\Entity\Mail\ImapMessageEntity();

        $entity->setDate($this->date);
        $entity->setSubject('subject');
        $entity->setTo('<EMAIL>');
        $entity->setCc('<EMAIL>');
        $entity->setBcc('<EMAIL>');
        $entity->setFrom('<EMAIL>');
        $entity->setReplyTo('<EMAIL>');
        $entity->setInReplyTo('<EMAIL>');
        $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(
                    'uId'        => "1",
                    'path'       => array('1', '2'),
                    'date'       => $this->date,
                    'subject'    => 'subject',
                    'to'         => '<EMAIL>',
                    'cc'         => '<EMAIL>',
                    'bcc'        => '<EMAIL>',
                    'from'       => '<EMAIL>',
                    'replyTo'    => '<EMAIL>',
                    'inReplyTo'  => '<EMAIL>',
                    'references' => 'references',
                    'messageId'  => '<messageId>',
                    'contentTextHtml'  => 'contentTextHtml',
{'fraction_non_alphanumeric': 0.1590370955011839, 'fraction_numerical': 0.014404104183109707, 'mean_word_length': 1.7578890097932536, 'pattern_counts': {'":': 0, '<': 41, '<?xml version=': 0, '>': 96, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5532221', 'n_tokens_mistral': 1562, 'n_tokens_neox': 1463, 'n_words': 243}