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");
24 sub new { bless {}, $_[0] }
25 sub config { \%config }
31 grep { $_ eq $class } @mock_isa or $self->SUPER::isa($class);
35 can_ok( $m, "setup" );
37 eval { MockCxt->new->setup }; # throws OK is not working with NEXT
40 qr/requires.*((?:State|Store).*){2}/i,
41 "can't setup an object that doesn't use state/store plugins"
44 $log->called_ok( "fatal", "fatal error logged" );
46 @mock_isa = qw/Catalyst::Plugin::Session::State/;
47 eval { MockCxt->new->setup };
48 like( $@, qr/requires.*(?:Store)/i,
49 "can't setup an object that doesn't use state/store plugins" );
51 @mock_isa = qw/Catalyst::Plugin::Session::Store/;
52 eval { MockCxt->new->setup };
53 like( $@, qr/requires.*(?:State)/i,
54 "can't setup an object that doesn't use state/store plugins" );
59 qw/Catalyst::Plugin::Session::State Catalyst::Plugin::Session::Store/;
60 eval { MockCxt->new->setup };
61 ok( !$@, "setup() lives with state/store plugins in use" );
62 ok( !$log->called("fatal"), "no fatal error logged either" );
65 [ keys %{ $config{session} } ],
66 bag(qw/expires verify_address/),
67 "default values for config were populated in successful setup",
70 %config = ( session => { expires => 1234 } );
72 is( $config{session}{expires},
73 1234, "user values are not overwritten in config" );