| line | stmt | bran | cond | sub | pod | time | code | 
| 1 |  |  |  |  |  |  | package Eve::EmailStub; | 
| 2 |  |  |  |  |  |  |  | 
| 3 | 1 |  |  | 1 |  | 921 | use strict; | 
|  | 1 |  |  |  |  | 2 |  | 
|  | 1 |  |  |  |  | 29 |  | 
| 4 | 1 |  |  | 1 |  | 4 | use warnings; | 
|  | 1 |  |  |  |  | 3 |  | 
|  | 1 |  |  |  |  | 21 |  | 
| 5 |  |  |  |  |  |  |  | 
| 6 | 1 |  |  | 1 |  | 4 | use vars qw(%ENV); | 
|  | 1 |  |  |  |  | 2 |  | 
|  | 1 |  |  |  |  | 54 |  | 
| 7 |  |  |  |  |  |  |  | 
| 8 | 1 |  |  | 1 |  | 21 | BEGIN { $ENV{EMAIL_SENDER_TRANSPORT} = 'Test'; } | 
| 9 |  |  |  |  |  |  |  | 
| 10 | 1 |  |  | 1 |  | 464 | use Eve::Email; | 
|  | 1 |  |  |  |  | 2 |  | 
|  | 1 |  |  |  |  | 73 |  | 
| 11 |  |  |  |  |  |  |  | 
| 12 |  |  |  |  |  |  | =head1 NAME | 
| 13 |  |  |  |  |  |  |  | 
| 14 |  |  |  |  |  |  | B - a helper stub class that replaces the mailer class. | 
| 15 |  |  |  |  |  |  |  | 
| 16 |  |  |  |  |  |  | =head1 SYNOPSIS | 
| 17 |  |  |  |  |  |  |  | 
| 18 |  |  |  |  |  |  | package SomeTestCase; | 
| 19 |  |  |  |  |  |  |  | 
| 20 |  |  |  |  |  |  | use Eve::EmailStub; | 
| 21 |  |  |  |  |  |  | use Eve::Email; | 
| 22 |  |  |  |  |  |  |  | 
| 23 |  |  |  |  |  |  | my $already_mocked_email = Eve::Email->new(from => $from_string); | 
| 24 |  |  |  |  |  |  |  | 
| 25 |  |  |  |  |  |  | $already_mocked_email->send( | 
| 26 |  |  |  |  |  |  | to => $address, | 
| 27 |  |  |  |  |  |  | subject => $subject, | 
| 28 |  |  |  |  |  |  | body => $body); | 
| 29 |  |  |  |  |  |  |  | 
| 30 |  |  |  |  |  |  | my $delivery = $already_mocked_email->get_delivery(); | 
| 31 |  |  |  |  |  |  |  | 
| 32 |  |  |  |  |  |  | is( | 
| 33 |  |  |  |  |  |  | $delivery->{'envelope'}->{'to'}->[0], | 
| 34 |  |  |  |  |  |  | $address); | 
| 35 |  |  |  |  |  |  |  | 
| 36 |  |  |  |  |  |  | =head1 DESCRIPTION | 
| 37 |  |  |  |  |  |  |  | 
| 38 |  |  |  |  |  |  | B is the class that uses the B class' | 
| 39 |  |  |  |  |  |  | internal testing feature to replace the sender's engine with a test engine. | 
| 40 |  |  |  |  |  |  |  | 
| 41 |  |  |  |  |  |  | =head1 METHODS | 
| 42 |  |  |  |  |  |  |  | 
| 43 |  |  |  |  |  |  | =head2 B | 
| 44 |  |  |  |  |  |  |  | 
| 45 |  |  |  |  |  |  | Returns testing information about a last sent message. | 
| 46 |  |  |  |  |  |  |  | 
| 47 |  |  |  |  |  |  | =cut | 
| 48 |  |  |  |  |  |  |  | 
| 49 |  |  |  |  |  |  | sub get_delivery { | 
| 50 | 2 |  |  | 2 | 1 | 14374 | my @deliveries = Email::Sender::Simple->default_transport->deliveries(); | 
| 51 |  |  |  |  |  |  |  | 
| 52 | 2 |  |  |  |  | 23 | return $deliveries[$#deliveries]; | 
| 53 |  |  |  |  |  |  | } | 
| 54 |  |  |  |  |  |  |  | 
| 55 |  |  |  |  |  |  | =head1 SEE ALSO | 
| 56 |  |  |  |  |  |  |  | 
| 57 |  |  |  |  |  |  | =over 4 | 
| 58 |  |  |  |  |  |  |  | 
| 59 |  |  |  |  |  |  | =item L | 
| 60 |  |  |  |  |  |  |  | 
| 61 |  |  |  |  |  |  | =item L | 
| 62 |  |  |  |  |  |  |  | 
| 63 |  |  |  |  |  |  | =item L | 
| 64 |  |  |  |  |  |  |  | 
| 65 |  |  |  |  |  |  | =back | 
| 66 |  |  |  |  |  |  |  | 
| 67 |  |  |  |  |  |  | =head1 LICENSE AND COPYRIGHT | 
| 68 |  |  |  |  |  |  |  | 
| 69 |  |  |  |  |  |  | Copyright 2010-2013 Sergey Konoplev, Igor Zinovyev. | 
| 70 |  |  |  |  |  |  |  | 
| 71 |  |  |  |  |  |  | This program is free software; you can redistribute it and/or modify it | 
| 72 |  |  |  |  |  |  | under the terms of either: the GNU General Public License as published | 
| 73 |  |  |  |  |  |  | by the Free Software Foundation; or the Artistic License. | 
| 74 |  |  |  |  |  |  |  | 
| 75 |  |  |  |  |  |  | See http://dev.perl.org/licenses/ for more information. | 
| 76 |  |  |  |  |  |  |  | 
| 77 |  |  |  |  |  |  | =head1 AUTHOR | 
| 78 |  |  |  |  |  |  |  | 
| 79 |  |  |  |  |  |  | =over 4 | 
| 80 |  |  |  |  |  |  |  | 
| 81 |  |  |  |  |  |  | =item L | 
| 82 |  |  |  |  |  |  |  | 
| 83 |  |  |  |  |  |  | =item L | 
| 84 |  |  |  |  |  |  |  | 
| 85 |  |  |  |  |  |  | =back | 
| 86 |  |  |  |  |  |  |  | 
| 87 |  |  |  |  |  |  | =cut | 
| 88 |  |  |  |  |  |  |  | 
| 89 |  |  |  |  |  |  | 1; |