README
1NAME
2 Test::Mock::LWP - Easy mocking of LWP packages
3
4SYNOPSIS
5
6Make LWP packages to make testing easier.
7
8 use Test::Mock::LWP;
9
10 # Setup fake response content and code
11 $Mock_response->mock( content => sub { 'foo' } );
12 $Mock_resp->mock( code => sub { 201 } );
13
14 # Validate args passed to request constructor
15 is_deeply $Mock_request->new_args, \@expected_args;
16
17 # Validate request headers
18 is_deeply [ $Mock_req->next_call ],
19 [ 'header', [ 'Accept', 'text/plain' ] ];
20
21 # Special User Agent Behaviour
22 $Mock_ua->mock( request => sub { die 'foo' } );
23
24DESCRIPTION
25
26This package arises from duplicating the same code to mock LWP et al in
27several different modules I've written. This version is very minimalist, but
28works for my needs so far. I'm very open to new suggestions and improvements.
29