6 use Test::More tests => 10;
10 my $m; BEGIN { use_ok($m = "Catalyst::Plugin::Session") }
13 my $log = Test::MockObject->new;
16 $log->set_true("fatal");
21 sub new { bless {}, $_[0] }
22 sub config { \%config };
27 grep { $_ eq $class } @mock_isa or $self->SUPER::isa($class);
33 eval { MockCxt->new->setup }; # throws OK is not working with NEXT
34 like($@, qr/requires.*((?:State|Store).*){2}/i, "can't setup an object that doesn't use state/store plugins");
36 $log->called_ok("fatal", "fatal error logged");
38 @mock_isa = qw/Catalyst::Plugin::Session::State/;
39 eval { MockCxt->new->setup };
40 like($@, qr/requires.*(?:Store)/i, "can't setup an object that doesn't use state/store plugins");
42 @mock_isa = qw/Catalyst::Plugin::Session::Store/;
43 eval { MockCxt->new->setup };
44 like($@, qr/requires.*(?:State)/i, "can't setup an object that doesn't use state/store plugins");
48 @mock_isa = qw/Catalyst::Plugin::Session::State Catalyst::Plugin::Session::Store/;
49 eval { MockCxt->new->setup };
50 ok(!$@, "setup() lives with state/store plugins in use");
51 ok(!$log->called("fatal"), "no fatal error logged either");
54 [ keys %{ $config{session} } ],
55 bag(qw/expires verify_address/),
56 "default values for config were populated in successful setup",
59 %config = (session => { expires => 1234 });
61 is($config{session}{expires}, 1234, "user values are not overwritten in config");