/**
  * Test make, passing all fields known
  *
  * @access public
  * @return null
  */
 public function testMakeHasAllKnownFields()
 {
     $overview = new \StdClass();
     $overview->subject = '=?ISO-8859-1?Q?Ultima_chamada_para_o_LiquidaShow!?=';
     $overview->from = 'Google <*****@*****.**>';
     $overview->to = '=?ISO-8859-1?Q?Destinatarios_de_e-mail_de_resumo?=';
     $overview->date = 'Sun, 10 Sep 2014 21:09:35 +0000 (UTC)';
     $overview->message_id = '<*****@*****.**>';
     $overview->references = 'yyyyyy@test';
     $overview->in_reply_to = 'xxxxx@test';
     $overview->size = '15250';
     $overview->uid = '111111';
     $overview->msgno = '22222';
     $overview->recent = '0';
     $overview->flagged = '1';
     $overview->answered = '0';
     $overview->deleted = '0';
     $overview->seen = '1';
     $overview->draft = '0';
     $overview->udate = '1410728740';
     $body = '=?ISO-8859-1?Q?Economize_de_verdade:_Voce_diz_o_quanto_que?= =?ISO-8859-1?Q?r_pagar_e_a_gente_negocia_o_preco_com_voce!?=';
     $Factory = new EntityFactory();
     $expected = new Message();
     $expected->setSubject('Ultima chamada para o LiquidaShow!');
     $expected->setFrom('Google <*****@*****.**>');
     $expected->setTo('Destinatarios de e-mail de resumo');
     $expected->setDate('Sun, 10 Sep 2014 21:09:35 +0000 (UTC)');
     $expected->setMessageId('<*****@*****.**>');
     $expected->setReferences('yyyyyy@test');
     $expected->setInReplyTo('xxxxx@test');
     $expected->setSize('15250');
     $expected->setUid('111111');
     $expected->setNumber('22222');
     $expected->setRecent('0');
     $expected->setFlagged('1');
     $expected->setAnswered('0');
     $expected->setDeleted('0');
     $expected->setSeen('1');
     $expected->setDraft('0');
     $expected->setUdate('1410728740');
     $expected->setBody('Economize de verdade: Voce diz o quanto quer pagar e a gente negocia o preco com voce!');
     $result = $Factory->make($overview, $body);
     $this->assertInstanceOf('EmailMD\\Entity\\Message', $result);
     $this->assertEquals($result, $expected);
     $overview2 = clone $overview;
     $overview2->recent = '1';
     $overview2->flagged = '0';
     $overview2->answered = '1';
     $overview2->deleted = '1';
     $overview2->seen = '0';
     $overview2->draft = '1';
     $expected->setRecent('1');
     $expected->setFlagged('0');
     $expected->setAnswered('1');
     $expected->setDeleted('1');
     $expected->setSeen('0');
     $expected->setDraft('1');
     $result = $Factory->make($overview2, $body);
     $this->assertInstanceOf('EmailMD\\Entity\\Message', $result);
     $this->assertEquals($result, $expected);
 }
Beispiel #2
0
 /**
  * Test for set and gets
  *
  * @access public
  * @return null
  */
 public function testSetGetAll()
 {
     $array = array('subject' => 'Integer elementum massa', 'from' => 'Google <*****@*****.**>', 'to' => '*****@*****.**', 'date' => 'Sun, 10 Sep 2014 21:09:35 +0000 (UTC)', 'message_id' => '<*****@*****.**>', 'references' => 'yyyyyy@test', 'in_reply_to' => 'xxxxx@test', 'size' => '15250', 'uid' => '111111', 'number' => '22222', 'recent' => '0', 'flagged' => '1', 'answered' => '0', 'deleted' => '0', 'seen' => '1', 'draft' => '0', 'udate' => '1410728740', 'body' => 'Proin ut quam eros. Donec sed lobortis diam. Nulla nec odio lacus. Quisque porttitor egestas dolor in placerat.');
     $message = new Message();
     $message->setSubject($array['subject']);
     $expected = $array['subject'];
     $result = $message->getSubject();
     $this->assertSame($result, $expected);
     $message->setFrom($array['from']);
     $expected = $array['from'];
     $result = $message->getFrom();
     $this->assertSame($result, $expected);
     $message->setTo($array['to']);
     $expected = $array['to'];
     $result = $message->getTo();
     $this->assertSame($result, $expected);
     $message->setDate($array['date']);
     $expected = $array['date'];
     $result = $message->getDate();
     $this->assertSame($result, $expected);
     $message->setMessageId($array['message_id']);
     $expected = $array['message_id'];
     $result = $message->getMessageId();
     $this->assertSame($result, $expected);
     $message->setReferences($array['references']);
     $expected = $array['references'];
     $result = $message->getReferences();
     $this->assertSame($result, $expected);
     $message->setInReplyTo($array['in_reply_to']);
     $expected = $array['in_reply_to'];
     $result = $message->getInReplyTo();
     $this->assertSame($result, $expected);
     $message->setSize($array['size']);
     $expected = $array['size'];
     $result = $message->getSize();
     $this->assertSame($result, $expected);
     $message->setUid($array['uid']);
     $expected = $array['uid'];
     $result = $message->getUid();
     $this->assertSame($result, $expected);
     $message->setNumber($array['number']);
     $expected = $array['number'];
     $result = $message->getNumber();
     $this->assertSame($result, $expected);
     $message->setRecent($array['recent']);
     $expected = false;
     $result = $message->getRecent();
     $this->assertSame($result, $expected);
     $message->setRecent('1');
     $expected = true;
     $result = $message->getRecent();
     $this->assertSame($result, $expected);
     $message->setFlagged($array['flagged']);
     $expected = true;
     $result = $message->getFlagged();
     $this->assertSame($result, $expected);
     $message->setFlagged('0');
     $expected = false;
     $result = $message->getFlagged();
     $this->assertSame($result, $expected);
     $message->setAnswered($array['answered']);
     $expected = false;
     $result = $message->getAnswered();
     $this->assertSame($result, $expected);
     $message->setAnswered('1');
     $expected = true;
     $result = $message->getAnswered();
     $this->assertSame($result, $expected);
     $message->setDeleted($array['deleted']);
     $expected = false;
     $result = $message->getDeleted();
     $this->assertSame($result, $expected);
     $message->setDeleted('1');
     $expected = true;
     $result = $message->getDeleted();
     $this->assertSame($result, $expected);
     $message->setSeen($array['seen']);
     $expected = true;
     $result = $message->getSeen();
     $this->assertSame($result, $expected);
     $message->setSeen('0');
     $expected = false;
     $result = $message->getSeen();
     $this->assertSame($result, $expected);
     $message->setDraft($array['draft']);
     $expected = false;
     $result = $message->getDraft();
     $this->assertSame($result, $expected);
     $message->setDraft('1');
     $expected = true;
     $result = $message->getDraft();
     $this->assertSame($result, $expected);
     $message->setUdate($array['udate']);
     $expected = $array['udate'];
     $result = $message->getUdate();
     $this->assertSame($result, $expected);
 }