Пример #1
0
 public function testGetContentMultipartText()
 {
     $this->part->expects($this->any())->method('isMultipart')->will($this->returnValue(true));
     $part1 = $this->getMockBuilder('Zend\\Mail\\Storage\\Part')->disableOriginalConstructor()->getMock();
     $part2 = $this->getMockBuilder('Zend\\Mail\\Storage\\Part')->disableOriginalConstructor()->getMock();
     $part1->expects($this->any())->method('isMultipart')->will($this->returnValue(false));
     $part2->expects($this->any())->method('isMultipart')->will($this->returnValue(false));
     $this->mockIterator($this->part, $part1, $part2);
     $this->preparePartMock($part1, 'part1Content', 'text/plain', '8Bit', 'ISO-8859-1');
     $this->preparePartMock($part2, 'part2Content', 'text/html', 'Base64', 'ISO-8859-1');
     // Test to TEXT body
     $result = $this->body->getContent(Body::FORMAT_TEXT);
     $this->assertEquals(new Content('part1Content', 'text/plain', '8Bit', 'ISO-8859-1'), $result);
     // Test to HTML body
     $result = $this->body->getContent(Body::FORMAT_HTML);
     $this->assertEquals(new Content('part2Content', 'text/html', 'Base64', 'ISO-8859-1'), $result);
 }
Пример #2
0
 /**
  * @expectedException \Oro\Bundle\ImapBundle\Mail\Storage\Exception\InvalidBodyFormatException
  */
 public function testGetContentSinglePartHtml()
 {
     $this->part->expects($this->once())->method('isMultipart')->will($this->returnValue(false));
     $this->body->getContent(Body::FORMAT_HTML);
 }