Authentication back compat fail due to ::ClassData not behaving like C::D::I, not...
[catagits/Catalyst-Runtime.git] / t / cdi_backcompat_plugin_accessor_override.t
diff --git a/t/cdi_backcompat_plugin_accessor_override.t b/t/cdi_backcompat_plugin_accessor_override.t
new file mode 100644 (file)
index 0000000..8a91781
--- /dev/null
@@ -0,0 +1,32 @@
+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 CDICompatTestApp;
+    use Catalyst qw/
+           +CDICompatTestPlugin
+    /;
+    # Calling ->config here (before we call setup). With CDI/Cat 5.70 this
+    # causes *CDICompatTestApp::_config to have a class data accessor created.
+    
+    # If this doesn't happen, then later when we've added CDICompatTestPlugin
+    # to @ISA, we fail in the overridden ->setup method when we call ->config
+    # again, as we get the CAF accessor from CDICompatTestPlugin, not the one
+    # created in this package as a side-effect of this call. :-(
+    __PACKAGE__->config;
+}
+
+TODO: {
+    local $TODO = 'The overridden setup in CDICompatTestApp + the overridden accessor causes destruction';
+    lives_ok {
+        CDICompatTestApp->setup;
+    } 'Setup app with plugins which says use base qw/Class::Accessor::Fast/';
+}