line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Mail::Action::RequestTest; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
520
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
30
|
|
4
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
27
|
|
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
5
|
use base 'Test::Class'; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
1186
|
|
7
|
|
|
|
|
|
|
|
8
|
1
|
|
|
1
|
|
34004
|
use Test::More; |
|
1
|
|
|
|
|
6330
|
|
|
1
|
|
|
|
|
8
|
|
9
|
|
|
|
|
|
|
|
10
|
7
|
|
|
7
|
0
|
17
|
sub module { 'Mail::Action::Request' } |
11
|
0
|
|
|
0
|
0
|
0
|
sub subclass { 'Mail::Action::RequestSub' } |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub default_headers |
14
|
|
|
|
|
|
|
{ |
15
|
|
|
|
|
|
|
return |
16
|
|
|
|
|
|
|
{ |
17
|
2
|
|
|
2
|
0
|
21
|
Cc => [], |
18
|
|
|
|
|
|
|
'Delivered-to' => [], |
19
|
|
|
|
|
|
|
From => [ 'me@home' ], |
20
|
|
|
|
|
|
|
Subject => [ 'Hi there' ], |
21
|
|
|
|
|
|
|
To => [], |
22
|
|
|
|
|
|
|
}; |
23
|
|
|
|
|
|
|
} |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
sub message |
26
|
|
|
|
|
|
|
{ |
27
|
6
|
|
|
6
|
0
|
39
|
return <<'END_HERE'; |
28
|
|
|
|
|
|
|
From: me@home |
29
|
|
|
|
|
|
|
To: you@house |
30
|
|
|
|
|
|
|
Subject: Hi there |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
Hello! |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
Bye for now! |
35
|
|
|
|
|
|
|
END_HERE |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
sub startup :Test( startup => 2 ) |
39
|
|
|
|
|
|
|
{ |
40
|
1
|
|
|
1
|
0
|
1465
|
my $self = shift; |
41
|
1
|
|
|
|
|
5
|
my $module = $self->module(); |
42
|
|
|
|
|
|
|
|
43
|
1
|
|
|
1
|
|
5
|
use_ok( $module ); |
|
1
|
|
|
|
|
736
|
|
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
24
|
|
44
|
1
|
|
|
|
|
771
|
can_ok( $module, 'new' ); |
45
|
1
|
|
|
1
|
|
388
|
} |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
10
|
|
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
sub setup :Test( setup ) |
48
|
|
|
|
|
|
|
{ |
49
|
4
|
|
|
4
|
0
|
5002
|
my $self = shift; |
50
|
4
|
|
|
|
|
16
|
my $module = $self->module(); |
51
|
4
|
|
|
|
|
13
|
$self->{req} = $module->new( $self->message() ); |
52
|
1
|
|
|
1
|
|
296
|
} |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
3
|
|
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
sub test_new :Test |
55
|
|
|
|
|
|
|
{ |
56
|
1
|
|
|
1
|
0
|
149
|
my $self = shift; |
57
|
1
|
|
|
|
|
4
|
my $module = $self->module(); |
58
|
1
|
|
|
|
|
5
|
isa_ok( $self->{req}, $module ); |
59
|
1
|
|
|
1
|
|
187
|
} |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
5
|
|
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
sub test_message :Test( 2 ) |
62
|
|
|
|
|
|
|
{ |
63
|
1
|
|
|
1
|
0
|
153
|
my $self = shift; |
64
|
1
|
|
|
|
|
5
|
my $message = $self->{req}->message(); |
65
|
|
|
|
|
|
|
|
66
|
1
|
|
|
|
|
6
|
isa_ok( $message, 'Email::MIME' ); |
67
|
1
|
|
|
|
|
441
|
like( $message->body_raw(), qr/Hello!.*Bye for now!/s, |
68
|
|
|
|
|
|
|
'message() should return Email::MIME containing raw message' ); |
69
|
1
|
|
|
1
|
|
269
|
} |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
4
|
|
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
sub test_headers :Test |
72
|
|
|
|
|
|
|
{ |
73
|
1
|
|
|
1
|
0
|
319
|
my $self = shift; |
74
|
1
|
|
|
|
|
6
|
is_deeply( $self->{req}->headers(), $self->default_headers(), |
75
|
|
|
|
|
|
|
'headers() should return hashref of parsed message headers' ); |
76
|
1
|
|
|
1
|
|
193
|
} |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
4
|
|
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
sub test_new_override_defaults :Test( 2 ) |
79
|
|
|
|
|
|
|
{ |
80
|
1
|
|
|
1
|
0
|
235
|
my $self = shift; |
81
|
1
|
|
|
|
|
6
|
my $module = $self->module(); |
82
|
1
|
|
|
|
|
6
|
my $headers = $self->default_headers(); |
83
|
1
|
|
|
|
|
5
|
$headers->{foo} = 'bar'; |
84
|
|
|
|
|
|
|
|
85
|
1
|
|
|
|
|
5
|
my $req = $module->new( $self->message(), |
86
|
|
|
|
|
|
|
headers => { foo => 'bar' }); |
87
|
|
|
|
|
|
|
|
88
|
1
|
|
|
|
|
6
|
is_deeply( $req->headers(), $headers, |
89
|
|
|
|
|
|
|
'additional arguments to new() should augment default headers' ); |
90
|
|
|
|
|
|
|
|
91
|
1
|
|
|
|
|
2815
|
$req = $module->new( $self->message(), recipient => 'a@b.to' ); |
92
|
|
|
|
|
|
|
|
93
|
1
|
|
|
|
|
36
|
is_deeply( $req->recipient(), 'a@b.to', |
94
|
|
|
|
|
|
|
'additional arguments to new() should overwrite defaults' ); |
95
|
1
|
|
|
1
|
|
309
|
} |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
3
|
|
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
1; |