line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Test::Mock::HTTP::Response; |
2
|
2
|
|
|
2
|
|
15
|
use strict; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
112
|
|
3
|
2
|
|
|
2
|
|
12
|
use warnings; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
139
|
|
4
|
2
|
|
|
2
|
|
12
|
use Test::MockObject; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
18
|
|
5
|
2
|
|
|
2
|
|
55
|
use base 'Exporter'; |
|
2
|
|
|
|
|
12
|
|
|
2
|
|
|
|
|
551
|
|
6
|
|
|
|
|
|
|
our @EXPORT = qw($Mock_resp $Mock_response); |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
our $Mock_resp; |
9
|
|
|
|
|
|
|
our $Mock_response; |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
=head1 NAME |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
Test::Mock::HTTP::Response - Mocks HTTP::Response |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
=cut |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
=head1 SYNOPSIS |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
Make HTTP::Response to make testing easier. |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
See Test::Mock::LWP manpage for more details. |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
This class uses Test::MockObject, so refer to it's documentation as well. |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
=cut |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
our $VERSION = '0.01'; |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
BEGIN { |
30
|
2
|
|
|
2
|
|
12
|
$Mock_response = $Mock_resp = Test::MockObject->new; |
31
|
2
|
|
|
|
|
26
|
$Mock_resp->fake_module('HTTP::Response'); |
32
|
2
|
|
|
|
|
90
|
$Mock_resp->fake_new('HTTP::Response'); |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
our %Headers; |
36
|
|
|
|
|
|
|
$Mock_resp->mock('header', sub { return $Headers{$_[1]} }); |
37
|
|
|
|
|
|
|
$Mock_resp->set_always('code', 200); |
38
|
|
|
|
|
|
|
$Mock_resp->set_always('content', ''); |
39
|
|
|
|
|
|
|
$Mock_resp->set_always('is_success', 1); |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
package # hide from PAUSE |
42
|
|
|
|
|
|
|
HTTP::Response; |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
our $VERSION = 'Mocked'; |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
=head1 AUTHOR |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
Luke Closs, C<< >> |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
=head1 BUGS |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
Please report any bugs or feature requests through the web interface at |
53
|
|
|
|
|
|
|
L. |
54
|
|
|
|
|
|
|
I will be notified, and then you'll automatically be notified of progress on |
55
|
|
|
|
|
|
|
your bug as I make changes. |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
=head1 SUPPORT |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
You can find documentation for this module with the perldoc command. |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
perldoc Test::Mock::LWP |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
You can also look for information at: |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
=over 4 |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
=item * AnnoCPAN: Annotated CPAN documentation |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
L |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
=item * CPAN Ratings |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
L |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
=item * RT: CPAN's request tracker |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
L |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
=item * Search CPAN |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
L |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
=back |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
=head1 ACKNOWLEDGEMENTS |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
=head1 COPYRIGHT & LICENSE |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
Copyright 2006 Luke Closs, all rights reserved. |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify it |
92
|
|
|
|
|
|
|
under the same terms as Perl itself. |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
=cut |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
1; |