From: Yousef H. Alhashemi Date: Thu, 3 Sep 2009 12:08:43 +0000 (+0000) Subject: Test that warnings are generated if appclass actions are used X-Git-Tag: 5.80013~12^2~3 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Runtime.git;a=commitdiff_plain;h=5ec24151d10209c4bf8b4522e515dd775b51fa9c Test that warnings are generated if appclass actions are used --- diff --git a/t/deprecated_appclass_action_warnings.t b/t/deprecated_appclass_action_warnings.t index 6d73d6e..a9979fe 100644 --- a/t/deprecated_appclass_action_warnings.t +++ b/t/deprecated_appclass_action_warnings.t @@ -7,7 +7,12 @@ use lib "$FindBin::Bin/lib"; use Test::More; use Catalyst::Test 'DeprecatedActionsInAppClassTestApp'; -plan tests => 2; +plan tests => 3; + +my $warnings; +my $logger = DeprecatedActionsInAppClassTestApp::Log->new; +Catalyst->log($logger); ok( my $response = request('http://localhost/foo'), 'Request' ); ok( $response->is_success, 'Response Successful 2xx' ); +is( $warnings, 1, 'Get the appclass action warning' ); \ No newline at end of file diff --git a/t/lib/DeprecatedActionsInAppClassTestApp.pm b/t/lib/DeprecatedActionsInAppClassTestApp.pm index bdf4b98..565bc3e 100644 --- a/t/lib/DeprecatedActionsInAppClassTestApp.pm +++ b/t/lib/DeprecatedActionsInAppClassTestApp.pm @@ -4,6 +4,10 @@ use strict; use warnings; use Catalyst; +our $VERSION = '0.01'; + +__PACKAGE__->config( name => 'DeprecatedActionsInAppClassTestApp', root => '/some/dir' ); +__PACKAGE__->log(DeprecatedActionsInAppClassTestApp::Log->new); __PACKAGE__->setup; sub foo : Local { @@ -11,4 +15,14 @@ sub foo : Local { $c->res->body('OK'); } +package DeprecatedActionsInAppClassTestApp::Log; +use strict; +use warnings; +use base qw/Catalyst::Log/; + +sub warn { + my ($self, $warning) = @_; + $warnings++ if $warning =~ /action methods .+ found defined/i; +} + 1;