5 no warnings 'redefine';
8 use lib "$FindBin::Bin/lib";
12 use Catalyst::Test 'TestApp';
14 my $get = sub { get(join '/', '/errors/signature_error_on_foo', @_) };
15 my $subget = sub { get(join '/', '/sub_errors/signature_error_on_foo', @_) };
16 my $modget = sub { get(join '/', '/sub_errors/signature_error_on_foo_modify', @_) };
19 local *TestApp::debug = sub { 0 };
23 like $get->('bar'), qr/come back later/i, 'normal handling of method validation error';
25 } qr/Validation failed/, 'method error throws validation error to error log';
29 like $subget->('bar'), qr/come back later/i, 'normal handling of method validation error (child)';
31 } qr/Validation failed/, 'method error throws validation error to error log (child)';
35 like $modget->('bar'), qr/come back later/i, 'normal handling of method validation error (modified)';
37 } qr/Validation failed/, 'method error throws validation error to error log (modified)';
39 is $get->('baz'), 'FOO BAR', 'make sure all works without any errors happening';
40 is $subget->('baz'), 'FOO BAR', 'make sure all works without any errors happening (child)';
41 is $modget->('baz'), 'FOO_MODIFY BAR', 'make sure all works without any errors happening (child)';
44 local *TestApp::debug = sub { 1 };
48 is $get->('baz'), 'FOO BAR', 'make sure all works without any errors happening in debug mode';
50 } qr/\[error\]/i, 'no errors in output';
54 is $subget->('baz'), 'FOO BAR', 'make sure all works without any errors happening in debug mode (child)';
56 } qr/\[error\]/i, 'no errors in output (child)';
60 is $modget->('baz'), 'FOO_MODIFY BAR', 'make sure all works without any errors happening in debug mode (modified)';
62 } qr/\[error\]/i, 'no errors in output (modified)';