Commit | Line | Data |
19a24dbb |
1 | #!/usr/bin/perl |
2 | |
3 | use strict; |
4 | use warnings; |
5 | use FindBin qw/$Bin/; |
6 | use lib "$Bin/lib"; |
7 | use Test::More tests => 4; |
19a24dbb |
8 | |
9 | my $warnings; |
10 | BEGIN { # Do this at compile time in case we generate a warning when use |
11 | # DeprecatedTestApp |
12 | $SIG{__WARN__} = sub { $warnings++ if $_[0] =~ /trying to use NEXT/ }; |
13 | } |
14 | use Catalyst; # Cause catalyst to be used so I can fiddle with the logging. |
15 | my $mvc_warnings; |
16 | BEGIN { |
6a163489 |
17 | my $logger = Class::MOP::Class->create_anon_class( |
18 | methods => { |
19 | warn => sub { |
20 | if ($_[1] =~ /switch your class names/) { |
21 | $mvc_warnings++; |
22 | return; |
23 | } |
24 | die "Caught unexpected warning: " . $_[1]; |
25 | }, |
26 | }, |
27 | )->new_object; |
19a24dbb |
28 | Catalyst->log($logger); |
29 | } |
30 | |
31 | use Catalyst::Test 'DeprecatedTestApp'; |
32 | is( $mvc_warnings, 1, 'Get the ::MVC:: warning' ); |
33 | |
34 | ok( my $response = request('http://localhost/'), 'Request' ); |
35 | is( $response->header('X-Catalyst-Plugin-Deprecated'), '1', 'NEXT plugin ran correctly' ); |
36 | |
d07c427a |
37 | SKIP: { |
38 | skip 'non-dev release', 1 unless Catalyst::_IS_DEVELOPMENT_VERSION(); |
39 | is( $warnings, 1, 'Got one and only one Adopt::NEXT warning'); |
40 | } |