6 use Test::More tests => 10;
11 BEGIN { use_ok( $m = "Catalyst::Plugin::Session" ) }
14 my $log = Test::MockObject->new;
17 $log->set_true("fatal");
23 sub new { bless {}, $_[0] }
24 sub config { \%config }
30 grep { $_ eq $class } @mock_isa or $self->SUPER::isa($class);
34 can_ok( $m, "setup" );
36 eval { MockCxt->new->setup }; # throws OK is not working with NEXT
39 qr/requires.*((?:State|Store).*){2}/i,
40 "can't setup an object that doesn't use state/store plugins"
43 $log->called_ok( "fatal", "fatal error logged" );
45 @mock_isa = qw/Catalyst::Plugin::Session::State/;
46 eval { MockCxt->new->setup };
47 like( $@, qr/requires.*(?:Store)/i,
48 "can't setup an object that doesn't use state/store plugins" );
50 @mock_isa = qw/Catalyst::Plugin::Session::Store/;
51 eval { MockCxt->new->setup };
52 like( $@, qr/requires.*(?:State)/i,
53 "can't setup an object that doesn't use state/store plugins" );
58 qw/Catalyst::Plugin::Session::State Catalyst::Plugin::Session::Store/;
59 eval { MockCxt->new->setup };
60 ok( !$@, "setup() lives with state/store plugins in use" );
61 ok( !$log->called("fatal"), "no fatal error logged either" );
64 [ keys %{ $config{session} } ],
65 bag(qw/expires verify_address/),
66 "default values for config were populated in successful setup",
69 %config = ( session => { expires => 1234 } );
71 is( $config{session}{expires},
72 1234, "user values are not overwritten in config" );