silence warnings in tests
[catagits/Catalyst-Runtime.git] / t / aggregate / unit_core_setup_log.t
index 1406944..6795047 100644 (file)
@@ -2,16 +2,24 @@ use strict;
 use warnings;
 
 use Test::More tests => 30;
-use Test::Exception;
 
 use Catalyst ();
 
 sub mock_app {
     my $name = shift;
-    print "Setting up mock application: $name\n";
     my $meta = Moose->init_meta( for_class => $name );
     $meta->superclasses('Catalyst');
-    return $meta->name;
+
+    $meta->add_after_method_modifier('log', sub {
+        my ($self, $log) = @_;
+        if ($log) {
+            open my $err_fh, '>', \(my $err_out)
+                or die 'unable to open in memory buffer';
+            $log->psgienv({ 'psgi.errors' => $err_fh });
+        }
+    });
+
+    return $name;
 }
 
 sub test_log_object {