Unfuck Makefile.PL
[catagits/Catalyst-Plugin-Session.git] / t / 06_finalize.t
CommitLineData
d3c97126 1#!/usr/bin/perl
2
3use strict;
4use warnings;
5
6use Test::More;
7
8BEGIN {
9 if ( eval { require Catalyst::Plugin::Session::State::Cookie } ) {
10 plan tests => 3;
11 } else {
12 plan skip_all => "Catalyst::Plugin::Session::State::Cookie required";
13 }
14}
15
16my $finalized = 0;
17
18{
19 package TestPlugin;
20 BEGIN { $INC{"TestPlugin.pm"} = 1 } # nasty hack for 5.8.6
21
22 sub finalize_session { $finalized = 1 }
23
24 sub finalize { die "already finalized_session()" if $finalized }
25
26 # Structure inheritance so TestPlugin->finalize() is called *after*
27 # Catalyst::Plugin::Session->finalize()
28 package TestApp;
29
30 use Catalyst qw/
31 Session Session::Store::Dummy Session::State::Cookie +TestPlugin
32 /;
33 __PACKAGE__->setup;
34}
35
36BEGIN { use_ok('Catalyst::Plugin::Session') }
37
38my $c = TestApp->new;
39eval { $c->finalize };
40ok(!$@, "finalize_session() called after all other finalize() methods");
41ok($finalized, "finalize_session() called");