CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion »
  • Unit Testing (Moderator: Michał Mach) »
  • Unit testing the contents of an email
Pages: 1 [2]

Author Topic: Unit testing the contents of an email  (Read 6557 times)

Eileen

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4195
  • Karma: 218
    • Fuzion
Re: Unit testing the contents of an email
November 01, 2012, 05:53:44 pm
OK - I'm moving a few settings from config to settings - once I get past a couple of problems I envisage it being pretty easy to move mail log & a few other debug settings to the settings table.
Make today the day you step up to support CiviCRM and all the amazing organisations that are using it to improve our world - http://civicrm.org/contribute

demeritcowboy

  • Ask me questions
  • ****
  • Posts: 570
  • Karma: 42
  • CiviCRM version: Always the latest!
  • CMS version: Drupal 6 mostly, still evaluating 7.
  • MySQL version: Mix of 5.0 / 5.1 / 5.5
  • PHP version: 5.3, usually on Windows
Re: Unit testing the contents of an email
December 09, 2012, 04:09:00 pm
In 4.3 there'll be an outbound mail setting for "redirect to database" which causes emails to show up as archived mailings. Since it's mostly for testing/logging I wasn't too concerned about all the various report fields that show up there, which all show as 0.

For unit testing it works in both webtest and non-webtest.

See http://issues.civicrm.org/jira/browse/CRM-11375 and http://issues.civicrm.org/jira/browse/CRM-11190

Basic usage:

Code: [Select]
$mut = new CiviMailUnitTest( $this, true ); //true automatically starts spooling
... do stuff ...
$msg = $mut->getMostRecentEmail( 'raw' ); // or 'ezc' to get an ezc mail object
 ... assert stuff about $msg ...
$mut->stop();

totten

  • Administrator
  • Ask me questions
  • *****
  • Posts: 695
  • Karma: 64
Re: Unit testing the contents of an email
December 10, 2012, 11:22:50 am
Cool!

Pages: 1 [2]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion »
  • Unit Testing (Moderator: Michał Mach) »
  • Unit testing the contents of an email

This forum was archived on 2017-11-26.