X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Runtime.git;a=blobdiff_plain;f=t%2Fdeprecated.t;h=307181b6ebfd92a9a1f0b805bb29ec07113f2fea;hp=a7e2997e43c7dfe8145110451fd7691f85a2e79d;hb=cb1e348badf54b4ceacca793b0baa6312e2a7e5d;hpb=d07c427aa5de2607a39fff482b5d012f3a3ebabd diff --git a/t/deprecated.t b/t/deprecated.t index a7e2997..307181b 100644 --- a/t/deprecated.t +++ b/t/deprecated.t @@ -5,18 +5,31 @@ use warnings; use FindBin qw/$Bin/; use lib "$Bin/lib"; use Test::More tests => 4; -use Test::MockObject; my $warnings; BEGIN { # Do this at compile time in case we generate a warning when use # DeprecatedTestApp - $SIG{__WARN__} = sub { $warnings++ if $_[0] =~ /trying to use NEXT/ }; + $SIG{__WARN__} = sub { + $warnings++ if $_[0] =~ /uses NEXT, which is deprecated/; + $warnings++ if $_[0] =~ /trying to use NEXT, which is deprecated/; + }; } use Catalyst; # Cause catalyst to be used so I can fiddle with the logging. my $mvc_warnings; BEGIN { - my $logger = Test::MockObject->new; - $logger->mock('warn', sub { $mvc_warnings++ if $_[1] =~ /switch your class names/ }); + my $logger = Class::MOP::Class->create_anon_class( + methods => { + debug => sub {0}, + info => sub {0}, + warn => sub { + if ($_[1] =~ /switch your class names/) { + $mvc_warnings++; + return; + } + die "Caught unexpected warning: " . $_[1]; + }, + }, +)->new_object; Catalyst->log($logger); } @@ -26,7 +39,4 @@ is( $mvc_warnings, 1, 'Get the ::MVC:: warning' ); ok( my $response = request('http://localhost/'), 'Request' ); is( $response->header('X-Catalyst-Plugin-Deprecated'), '1', 'NEXT plugin ran correctly' ); -SKIP: { - skip 'non-dev release', 1 unless Catalyst::_IS_DEVELOPMENT_VERSION(); - is( $warnings, 1, 'Got one and only one Adopt::NEXT warning'); -} +is( $warnings, 1, 'Got one and only one Adopt::NEXT warning');