line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Test::Mock::LWP::UserAgent; |
2
|
2
|
|
|
2
|
|
37722
|
use strict; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
200
|
|
3
|
2
|
|
|
2
|
|
13
|
use warnings; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
58
|
|
4
|
2
|
|
|
2
|
|
1219
|
use Test::MockObject; |
|
2
|
|
|
|
|
5367
|
|
|
2
|
|
|
|
|
14
|
|
5
|
2
|
|
|
2
|
|
17583
|
use Test::Mock::HTTP::Response; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
285
|
|
6
|
2
|
|
|
2
|
|
1069
|
use Test::Mock::HTTP::Request; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
309
|
|
7
|
2
|
|
|
2
|
|
12
|
use base 'Exporter'; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
416
|
|
8
|
|
|
|
|
|
|
our @EXPORT = qw($Mock_ua); |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
our $Mock_ua; |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
=head1 NAME |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
Test::Mock::LWP::UserAgent - Mocks LWP::UserAgent |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
=cut |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
=head1 SYNOPSIS |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
Make LWP::UserAgent to make testing easier. |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
See Test::Mock::LWP manpage for more details. |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
This class uses Test::MockObject, so refer to it's documentation as well. |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
=cut |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
our $VERSION = '0.01'; |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
BEGIN { |
31
|
2
|
|
|
2
|
|
9
|
$Mock_ua = Test::MockObject->new; |
32
|
2
|
|
|
|
|
29
|
$Mock_ua->fake_module('LWP::UserAgent'); |
33
|
2
|
|
|
|
|
73
|
$Mock_ua->fake_new('LWP::UserAgent'); |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
$Mock_ua->set_always('simple_request', HTTP::Response->new); |
37
|
|
|
|
|
|
|
$Mock_ua->set_always('request', HTTP::Response->new); |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
package # hide from PAUSE |
40
|
|
|
|
|
|
|
LWP::UserAgent; |
41
|
2
|
|
|
2
|
|
263
|
use strict; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
201
|
|
42
|
2
|
|
|
2
|
|
11
|
use warnings; |
|
2
|
|
|
|
|
20
|
|
|
2
|
|
|
|
|
230
|
|
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; |