1Plack::Middleware::TestU:s:eSrtaCsohnWtarrinbiuntgesdP(l3Pa)ecrkl::DMoicdudmleenwtaartei:o:nTest::StashWarnings(3)
2
3
4

NAME

6       Plack::Middleware::Test::StashWarnings - Test your application's
7       warnings
8

SYNOPSIS

10         # for your PSGI application:
11         enable "Test::StashWarnings";
12
13
14         # for your Test::WWW::Mechanize subclass:
15         use Storable 'thaw';
16         sub get_warnings {
17             local $Test::Builder::Level = $Test::Builder::Level + 1;
18             my $self = shift;
19
20             my $clone = $self->clone;
21             return unless $clone->get_ok('/__test_warnings');
22
23             my @warnings = @{ thaw $clone->content };
24             return @warnings;
25         }
26

DESCRIPTION

28       Plack::Middleware::Test::StashWarnings is a Plack middleware component
29       to record warnings generated by your application so that you can test
30       them to make sure your application complains about the right things.
31
32       The warnings generated by your application are available at a special
33       URL ("/__test_warnings"), encoded with "nfreeze" in Storable. So using
34       Test::WWW::Mechanize you can just "get" that URL and "thaw" in Storable
35       its content.
36

RATIONALE

38       Warnings are an important part of any application. Your web application
39       should warn its operators when something is amiss.
40
41       Almost as importantly, your web application should gracefully cope with
42       bad input, the back button, and all other aspects of the user
43       experience.
44
45       Unfortunately, tests seldom cover what happens when things go poorly.
46       Are you sure that your application correctly denies that action and
47       logs the failure? Are you sure it will tomorrow?
48
49       This module lets you retrieve the warnings that your forked server
50       issues. That way you can test that your application continues to issue
51       warnings when it makes sense. Catching the warnings also keeps your
52       test output tidy. Finally, you'll be able to see (and be notified via
53       failing tests) when your application issues new, unexpected warnings so
54       you can fix them immediately.
55

AUTHOR

57       Shawn M Moore "sartak@bestpractical.com"
58
59       Tatsuhiko Miyagawa wrote Plack::Middleware::Test::Recorder which served
60       as a model for this module.
61

LICENSE

63       This library is free software; you can redistribute it and/or modify it
64       under the same terms as Perl itself.
65

SEE ALSO

67       Test::HTTP::Server::Simple::StashWarnings
68
69
70
71perl v5.12.3                      2011P-l0a6c-k0:8:Middleware::Test::StashWarnings(3)
Impressum