Source for file Mail.php

Documentation is available at Mail.php

  1. <?php
  2. /**
  3.  *  Magentron EmailImages Extension
  4.  *
  5.  *  @category   Magentron
  6.  *  @package    Magentron_EmailImages
  7.  *  @author     Jeroen Derks
  8.  *  @copyright  Copyright (c) 2011 Jeroen Derks http://www.magentron.com
  9.  *  @license    http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  10.  */
  11. class Magentron_EmailImages_Test_Model_Mail extends EcomDev_PHPUnit_Test_Case
  12. {
  13.     /**
  14.      *  Test setContent()
  15.      *
  16.      *  @test
  17.      *  @doNotIndexAll
  18.      */
  19.     public function testContext()
  20.     {
  21.         /** @var    $mail   Magentron_EmailImages_Model_Mail */
  22.         $mail       Mage::getModel('emailimages/mail');
  23.         $context    md5(uniqid(''1));
  24.  
  25.         $mail->setContext($context);
  26.  
  27.         $this->assertEquals('Magentron_EmailImages_Model_Mail'get_class($mail)'emailimages/mail');
  28.         $this->assertEquals($context$mail->getContext()'context');
  29.         
  30.         return $this;
  31.     }
  32.     
  33.     
  34.     /**
  35.      *  Test send()
  36.      *
  37.      *  test
  38.      *  @loadFixture
  39.      *  @doNotIndexAll
  40.      */
  41.     public function testSend()
  42.     {
  43.         /** @var    $mail   Magentron_EmailImages_Model_Mail */
  44.         $mail Mage::getModel('emailimages/mail')
  45.                     ->setFrom(  Mage::getStoreConfig('trans_email/ident_general/email'))
  46.                     ->addTo(    Mage::getStoreConfig('trans_email/ident_support/email'))
  47.                     ->setSubject('Test subject')
  48.                     ->setContext('test-html-' md5('test-html'))
  49.                     ->setBodyHtml('<html><body><img src="' Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_SKIN'frontend/default/default/images/logo.gif" /></body></html>');
  50.  
  51.         // set transport to $this to prevent actually sending mail and calling assert functions
  52.         $mail->send($this);
  53.     }
  54.     
  55.     
  56.     /**
  57.      *  Zend_Mail_Transport function send()
  58.      */
  59.     public function send$mail )
  60.     {
  61.         $this->assertEquals(1$mail->getPartCount()'HTML email should have 1 attachment');
  62.     }
  63. }

Documentation generated on Fri, 09 Oct 2015 03:37:10 +0200 by phpDocumentor 1.4.4