[Catalyst-commits] r9373 - in Catalyst-Runtime/5.80/trunk: lib t

t0m at dev.catalyst.perl.org t0m at dev.catalyst.perl.org
Fri Feb 20 16:58:59 GMT 2009


Author: t0m
Date: 2009-02-20 16:58:59 +0000 (Fri, 20 Feb 2009)
New Revision: 9373

Modified:
   Catalyst-Runtime/5.80/trunk/lib/Catalyst.pm
   Catalyst-Runtime/5.80/trunk/t/unit_core_plugin.t
Log:
Upgrade that debug statement to a warning + test we get the warning we expect to

Modified: Catalyst-Runtime/5.80/trunk/lib/Catalyst.pm
===================================================================
--- Catalyst-Runtime/5.80/trunk/lib/Catalyst.pm	2009-02-20 16:58:50 UTC (rev 9372)
+++ Catalyst-Runtime/5.80/trunk/lib/Catalyst.pm	2009-02-20 16:58:59 UTC (rev 9373)
@@ -897,7 +897,7 @@
     my ( $class, $name, $plugin, @args ) = @_;
 
     # See block comment in t/unit_core_plugin.t    
-    $class->log->debug(qq/Adding plugin using the ->plugin method is deprecated, and will be removed in Catalyst 5.9/);
+    $class->log->warn(qq/Adding plugin using the ->plugin method is deprecated, and will be removed in Catalyst 5.9/);
     
     $class->_register_plugin( $plugin, 1 );
 

Modified: Catalyst-Runtime/5.80/trunk/t/unit_core_plugin.t
===================================================================
--- Catalyst-Runtime/5.80/trunk/t/unit_core_plugin.t	2009-02-20 16:58:50 UTC (rev 9372)
+++ Catalyst-Runtime/5.80/trunk/t/unit_core_plugin.t	2009-02-20 16:58:59 UTC (rev 9373)
@@ -2,8 +2,9 @@
 
 use strict;
 use warnings;
+use Test::MockObject::Extends;
 
-use Test::More tests => 22;
+use Test::More tests => 24;
 
 use lib 't/lib';
 
@@ -16,13 +17,29 @@
     sub count { $count++ }
 }
 
+my $warnings = 0;
+
+use PluginTestApp;
+my $logger = Test::MockObject::Extends->new(PluginTestApp->log);
+$logger->mock('warn', sub {
+    if ($_[1] =~ /plugin method is deprecated/) {
+        $warnings++;
+        return;
+    }
+    die "Caught unexpected warning: " . $_[1];
+});
+#PluginTestApp->log($logger);
+
 use Catalyst::Test qw/PluginTestApp/;
 
 ok( get("/compile_time_plugins"), "get ok" );
+is( $warnings, 0, 'no warnings' );
 # FIXME - Run time plugin support is insane, and should be removed
 #         for Catalyst 5.9
 ok( get("/run_time_plugins"),     "get ok" );
 
+is( $warnings, 1, '1 warning' );
+
 use_ok 'TestApp';
 my @expected = qw(
   Catalyst::Plugin::Test::Errors




More information about the Catalyst-commits mailing list