[Catalyst-commits] r6438 - trunk/Catalyst-Plugin-Session/t

mla at dev.catalyst.perl.org mla at dev.catalyst.perl.org
Mon May 28 22:16:51 GMT 2007


Author: mla
Date: 2007-05-28 22:16:50 +0100 (Mon, 28 May 2007)
New Revision: 6438

Added:
   trunk/Catalyst-Plugin-Session/t/06_finalize.t
Log:
make sure finalize_session() is called after all other finalize() methods have run

Added: trunk/Catalyst-Plugin-Session/t/06_finalize.t
===================================================================
--- trunk/Catalyst-Plugin-Session/t/06_finalize.t	                        (rev 0)
+++ trunk/Catalyst-Plugin-Session/t/06_finalize.t	2007-05-28 21:16:50 UTC (rev 6438)
@@ -0,0 +1,31 @@
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+
+use Test::More tests => 2;
+
+{
+  package MyTestPlugin;
+  use strict;
+
+  my $finalized = 0;
+  sub finalize_session { $finalized = 1 }
+
+  sub finalize { die "already finalized_session()" if $finalized }
+
+  # Structure inheritance so MyTestPlugin->finalize() is called *after* 
+  # Catalyst::Plugin::Session->finalize()
+  package TestApp;
+
+  use Catalyst qw/ Session Session::Store::Dummy Session::State::Cookie +MyTestPlugin /;
+  __PACKAGE__->config(session => { expires => 1000 });
+  __PACKAGE__->setup;
+}
+
+my $m;
+BEGIN { use_ok( $m = "Catalyst::Plugin::Session" ) }
+
+my $c = TestApp->new;
+eval { $c->finalize };
+ok(!$@, "finalize_session() called after all other finalize() methods");




More information about the Catalyst-commits mailing list