[Catalyst-commits] r6816 - in trunk/Catalyst-View-Mason/t: .
lib/TestApp
rafl at dev.catalyst.perl.org
rafl at dev.catalyst.perl.org
Tue Aug 28 17:04:34 GMT 2007
Author: rafl
Date: 2007-08-28 17:04:34 +0100 (Tue, 28 Aug 2007)
New Revision: 6816
Added:
trunk/Catalyst-View-Mason/t/lib/TestApp/FakeLog.pm
Modified:
trunk/Catalyst-View-Mason/t/deprecation.t
Log:
Test deprecation warnings without Test::MockObject::Extends to get rid of a warning.
Modified: trunk/Catalyst-View-Mason/t/deprecation.t
===================================================================
--- trunk/Catalyst-View-Mason/t/deprecation.t 2007-08-28 16:04:28 UTC (rev 6815)
+++ trunk/Catalyst-View-Mason/t/deprecation.t 2007-08-28 16:04:34 UTC (rev 6816)
@@ -2,23 +2,16 @@
use strict;
use warnings;
-use Test::More;
+use Test::More tests => 4;
-eval 'use Test::MockObject::Extends';
-plan skip_all => 'Test::MockModule::Extends required' if $@;
-
-plan tests => 4;
-
use FindBin;
use lib "$FindBin::Bin/lib";
-use Catalyst::Log;
+use TestApp::FakeLog;
my @warnings;
-my $log = Catalyst::Log->new;
-my $mock_log = Test::MockObject::Extends->new($log);
-$mock_log->mock(warn => sub { push @warnings, $_[1] });
+my $mock_log = TestApp::FakeLog->new(\@warnings);
{
no warnings 'once';
Added: trunk/Catalyst-View-Mason/t/lib/TestApp/FakeLog.pm
===================================================================
--- trunk/Catalyst-View-Mason/t/lib/TestApp/FakeLog.pm (rev 0)
+++ trunk/Catalyst-View-Mason/t/lib/TestApp/FakeLog.pm 2007-08-28 16:04:34 UTC (rev 6816)
@@ -0,0 +1,22 @@
+package TestApp::FakeLog;
+
+use strict;
+use warnings;
+use NEXT;
+use base qw/Catalyst::Log/;
+
+sub new {
+ my ($self, $warnings_ref, @args) = @_;
+
+ $self = $self->NEXT::new(@args);
+ $self->{_warnings_ref} = $warnings_ref;
+
+ return $self;
+}
+
+sub warn {
+ my ($self, $msg) = @_;
+ push @{ $self->{_warnings_ref} }, $msg;
+}
+
+1;
More information about the Catalyst-commits
mailing list