from override to around, because that actually works
[catagits/Catalyst-Plugin-Static-Simple.git] / t / 20debug.t
CommitLineData
151b8e0f 1#!perl\r
2\r
3use strict;\r
4use warnings;\r
5\r
6use FindBin;\r
7use lib "$FindBin::Bin/lib";\r
8\r
9use Test::More tests => 5;\r
10use Catalyst::Test 'TestApp';\r
11\r
12# test defined static dirs\r
13TestApp->config->{static}->{dirs} = [\r
14 'always-static',\r
15];\r
16\r
17TestApp->config->{static}->{debug} = 1;\r
18\r
19use Catalyst::Log;\r
20\r
21local *Catalyst::Log::_send_to_log;\r
22local our @MESSAGES;\r
23{\r
24 no warnings 'redefine';\r
25 *Catalyst::Log::_send_to_log = sub {\r
26 my $self = shift;\r
27 push @MESSAGES, @_;\r
28 };\r
29}\r
30\r
31\r
32# a missing file in a defined static dir will return 404 and text/html\r
33ok( my $res = request('http://localhost/always-static/404.txt'), 'request ok' );\r
34is( $res->code, 404, '404 ok' );\r
35is( $res->content_type, 'text/html', '404 is text/html' );\r
36ok(defined $MESSAGES[0], 'debug message set');\r
37like( $MESSAGES[0], qr/404/, 'debug message contains 404'); \r
38\r