Email::Send::Test::DataDumper - Captures emails sent via Email::Send for testing, with Tie::DataDumper


Email-Send-Test-DataDumper documentation  | view source Contained in the Email-Send-Test-DataDumper distribution.

Index


NAME

Top

Email::Send::Test::DataDumper - Captures emails sent via Email::Send for testing, with Tie::DataDumper

SYNOPSIS

Top

  # Load as normal
  use Email::Send;
  use Email::Send::Test::DataDumper;

  # First, set the filename for Tie::DataDumper
  $Email::Send::Test::DataDumper::FILENAME = 'sentmail.txt';

  # Always clear the email trap before each test to prevent unexpected
  # results, and thus spurious test results.
  Email::Send::Test::DataDumper->clear;

  ### BEGIN YOUR CODE TO BE TESTED (example follows)
  my $sender = Email::Send->new({ mailer => 'Test::DataDumper', mailer_args => [ 'sentmail.txt' ] });
  $sender->send( $message );
  ### END YOUR CODE TO BE TESTED

  # Check that the number and type (and content) of mails
  # matched what you expect.
  my @emails = Email::Send::Test::DataDumper->emails;
  is( scalar(@emails), 1, 'Sent 1 email' );
  isa_ok( $emails[0], 'Email::MIME' ); # Email::Simple subclasses pass through

DESCRIPTION

Top

Email::Send::Test::DataDumper is

AUTHOR

Top

Nobuo Danjou <nobuo.danjou@gmail.com>

SEE ALSO

Top

Email::Send::Test, Tie::DataDumper

LICENSE

Top

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.


Email-Send-Test-DataDumper documentation  | view source Contained in the Email-Send-Test-DataDumper distribution.