[Catalyst-commits] r8781 - in Catalyst-Runtime/5.80/trunk/t: . lib
t0m at dev.catalyst.perl.org
t0m at dev.catalyst.perl.org
Sun Dec 7 18:33:07 GMT 2008
Author: t0m
Date: 2008-12-07 18:33:07 +0000 (Sun, 07 Dec 2008)
New Revision: 8781
Added:
Catalyst-Runtime/5.80/trunk/t/caf_backcompat_plugin_accessor_override.t
Catalyst-Runtime/5.80/trunk/t/lib/CAFCompatTestPlugin.pm
Log:
Add test case for the thing which breaks C::P::Authentication
Added: Catalyst-Runtime/5.80/trunk/t/caf_backcompat_plugin_accessor_override.t
===================================================================
--- Catalyst-Runtime/5.80/trunk/t/caf_backcompat_plugin_accessor_override.t (rev 0)
+++ Catalyst-Runtime/5.80/trunk/t/caf_backcompat_plugin_accessor_override.t 2008-12-07 18:33:07 UTC (rev 8781)
@@ -0,0 +1,24 @@
+use strict;
+use warnings;
+use lib 't/lib';
+
+use Test::More tests => 1;
+use Test::Exception;
+
+# Force a stack trace.
+use Carp;
+$SIG{__DIE__} = \&Carp::confess;
+
+{
+ package CAFCompatTestApp;
+ use Catalyst qw/
+ +CAFCompatTestPlugin
+ /;
+}
+
+TODO: {
+ local $TODO = 'The overridden setup in CAFCompatTestApp + the overridden accessor causes destruction';
+ lives_ok {
+ CAFCompatTestApp->setup;
+ } 'Setup app with plugins which says use base qw/Class::Accessor::Fast/';
+}
Added: Catalyst-Runtime/5.80/trunk/t/lib/CAFCompatTestPlugin.pm
===================================================================
--- Catalyst-Runtime/5.80/trunk/t/lib/CAFCompatTestPlugin.pm (rev 0)
+++ Catalyst-Runtime/5.80/trunk/t/lib/CAFCompatTestPlugin.pm 2008-12-07 18:33:07 UTC (rev 8781)
@@ -0,0 +1,30 @@
+package CAFCompatTestPlugin;
+
+# This plugin specificially tests an edge case of CAF compat,
+# where you load a plugin which uses base CAF, and then override
+# a core catalyst accessor (_config in this case)..
+
+# This is what happens if you use the authentication back-compat
+# stuff, as C::A::Plugin::Credential::Password is added to the plugin
+# list, and the base C::A::C::P class, does the mk_accessors, and
+# then the C::P::A class calls the config method before setup finishes...
+
+use strict;
+use warnings;
+
+# Note that we don't actually _really_ use CAF here, as MX::Adopt::CAF
+# is in place...
+use base qw/Class::Accessor::Fast/;
+
+BEGIN {
+ __PACKAGE__->mk_accessors(qw/_config/);
+}
+
+sub setup {
+ my $app = shift;
+
+ $app->config;
+ $app->NEXT::setup(@_);
+}
+
+1;
More information about the Catalyst-commits
mailing list