Need newer LWP for tests to pass as suggested on list by Jose Luis Martinez
[catagits/Catalyst-Runtime.git] / t / unit_core_plugin.t
index cb48159..03d16f6 100644 (file)
@@ -2,7 +2,6 @@
 
 use strict;
 use warnings;
-use Test::MockObject::Extends;
 
 use Test::More tests => 24;
 
@@ -20,15 +19,21 @@ use lib 't/lib';
 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);
+my $logger = Class::MOP::Class->create_anon_class(
+    methods => {
+        error => sub {0},
+        debug => sub {0},
+        info => sub {0},
+        warn => sub {
+            if ($_[1] =~ /plugin method is deprecated/) {
+               $warnings++;
+                return;
+            }
+            die "Caught unexpected warning: " . $_[1];
+        },
+    },
+)->new_object;
+PluginTestApp->log($logger);
 
 use Catalyst::Test qw/PluginTestApp/;
 
@@ -38,6 +43,8 @@ is( $warnings, 0, 'no warnings' );
 #         for Catalyst 5.9
 ok( get("/run_time_plugins"),     "get ok" );
 
+local $ENV{CATALYST_DEBUG} = 0;
+
 is( $warnings, 1, '1 warning' );
 
 use_ok 'TestApp';
@@ -54,3 +61,4 @@ my @expected = qw(
 # Faux::Plugin is no longer reported
 is_deeply [ TestApp->registered_plugins ], \@expected,
   'registered_plugins() should only report the plugins for the current class';
+