Changelog, adjust warning text, bump versions for a dev release. The 'we do get Class...
[catagits/Catalyst-Runtime.git] / t / deprecated.t
CommitLineData
19a24dbb 1#!/usr/bin/perl
2
3use strict;
4use warnings;
5use FindBin qw/$Bin/;
6use lib "$Bin/lib";
7use Test::More tests => 4;
19a24dbb 8
9my $warnings;
10BEGIN { # 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}
14use Catalyst; # Cause catalyst to be used so I can fiddle with the logging.
15my $mvc_warnings;
16BEGIN {
6a163489 17 my $logger = Class::MOP::Class->create_anon_class(
18 methods => {
6b4ae531 19 debug => sub {0},
20 info => sub {0},
6a163489 21 warn => sub {
22 if ($_[1] =~ /switch your class names/) {
23 $mvc_warnings++;
24 return;
25 }
26 die "Caught unexpected warning: " . $_[1];
27 },
28 },
29)->new_object;
19a24dbb 30 Catalyst->log($logger);
31}
32
33use Catalyst::Test 'DeprecatedTestApp';
34is( $mvc_warnings, 1, 'Get the ::MVC:: warning' );
35
36ok( my $response = request('http://localhost/'), 'Request' );
37is( $response->header('X-Catalyst-Plugin-Deprecated'), '1', 'NEXT plugin ran correctly' );
38
d07c427a 39SKIP: {
40 skip 'non-dev release', 1 unless Catalyst::_IS_DEVELOPMENT_VERSION();
41 is( $warnings, 1, 'Got one and only one Adopt::NEXT warning');
42}